PHP code example of tolacika / laravel-cron-bundle

1. Go to this page and download the library: Download tolacika/laravel-cron-bundle 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/ */

    

tolacika / laravel-cron-bundle example snippets


use Tolacika\CronBundle\CronBundle;

/**
 * Bootstrap any application services.
 *
 * @return void
 */
public function boot()
{
    // ...
    CronBundle::auth(function ($request) {
        // returns true or false
        return auth()->check();
    });
    // ...
}

use Tolacika\CronBundle\CronBundle;

/**
 * Bootstrap any application services.
 *
 * @return void
 */
public function boot()
{
    // ...
    CronBundle::setUser(function ($request) {
        // the return type must be an integer, or null
        return auth()->user() ? auth()->user()->id : null;
    });
    // ...
}
bash
php artisan migrate
bash
php artisan vendor:publish --provider="Tolacika\CronBundle\CronBundleServiceProvider"
bash
php artisan cron-bundle:start