当前位置:网站首页>Scheduled backup of laravel 8 database

Scheduled backup of laravel 8 database

2022-06-09 21:16:00 Results of persistence and effort

composer install

composer require spatie/laravel-backup

Publish profile , produce config/backup.php

php artisan vendor:publish --provider="Spatie\Backup\BackupServiceProvider"

stay App\Console\Kernel Write code

protected function schedule(Schedule $schedule)
    {
        // $schedule->command('inspire')->hourly();

        //  Database backup per minute 
        $schedule->command('backup:run --disable-notifications')->everyMinute();
    }

stay config/filesystems.php Modify the backup save location ( Save to public Under the zip Next )

'disks' => [

        'local' => [
            'driver' => 'local',
            'root' => public_path('zip'),
        ],

Perform backup tasks

php artisan schedule:work
原网站

版权声明
本文为[Results of persistence and effort]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/160/202206092049001111.html