PHP code example of signifly / laravel-scheduling-tasks

1. Go to this page and download the library: Download signifly/laravel-scheduling-tasks library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

signifly / laravel-scheduling-tasks example snippets


// Inside the app/Console/Kernel.php file add this
use Signifly\SchedulingTasks\Facades\TaskLoader;

protected function schedule(Schedule $schedule)
{
    TaskLoader::loadFor($schedule);
}



namespace App\Console\Tasks;

use Signifly\SchedulingTasks\TaskContract;
use Illuminate\Console\Scheduling\Schedule;

class BackupDaily implements TaskContract
{
    public function __invoke(Schedule $schedule)
    {
        $schedule->command('backup:run')
            ->daily()
            ->at('01:00');
    }
}

protected function schedule(Schedule $schedule)
{
    TaskLoader::loadFor($schedule, [
        \App\Console\Tasks\BackupDaily::class,
    ]);

    // \App\Console\Tasks\BackupDaily::class will not get loaded.
}
bash
$ php artisan make:task BackupDaily