We would like to share with you how to take database backup in laravel. the laravel provide “spatie/laravel-backup” package.
This package through we can easily take database backup based on daily and hourly using a command line. we can also take MySQL database backup and PostgreSQL database backup from laravel application using this package.
So you can follow the below steps for database backup.
Step 1: Install Package
Now, We will install spatie/laravel-backup package using the below command.
composer require spatie/laravel-backup
Read Also: Create And Download Zip File In Laravel 7
Step 2: Backup Configuration
This below command through we can automatically register service provider and publish this package.
php artisan vendor:publish --provider="Spatie\Backup\BackupServiceProvider"
Step 3: Take Backup
finally, we will take all the files and database using below command.
php artisan backup:run
I hope it will help you…