<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
robersonfaria / laravel-database-schedule example snippets
artisan migrate
return [
//...
/**
* If restricted_access is true, the user must be authenticated and meet the definition of `viewDatabaseSchedule` gate
*/
'restricted_access' => env('SCHEDULE_RESTRICTED_ACCESS', true),
//...
]
protected function gate()
{
Gate::define('viewDatabaseSchedule', function ($user) {
return in_array($user->email, [
'[email protected]',
]);
});
}
Gate::define('viewDatabaseSchedule', function ($user) {
return $user->hasRole('administrator');
});
/**
* If you have a lot of jobs, you can group them for easier managing of jobs.
*/
'enable_groups' => true,
namespace App\Console\Commands;
use Illuminate\Console\Command;
class test extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'command:test {user} {initialDate} {finalDate}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$this->info('Hello ' . $this->argument('user'));
$this->info("Initial Date: " . $this->argument('initialDate'));
$this->info("Final Date: " . $this->argument('finalDate'));
return 0;
}
}