PHP code example of nunomaduro / laravel-console-task
1. Go to this page and download the library: Download nunomaduro/laravel-console-task 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/ */
nunomaduro / laravel-console-task example snippets
class LaravelInstallCommand extends Command
{
/**
* Execute the console command.
*
* @return void
*/
public function handle()
{
$this->task('Installing Laravel', function () {
return true;
});
$this->task('Doing something else', function () {
return false;
});
// Specify a 3rd parameter for a custom loading message
// Default is `loading...`
$this->task('Long task', function () {
sleep(60);
return true;
}, 'sleeping...');
}
}