Create console:
php artisan make:console CrawDataRx
Create console and command:
php artisan make:console CrawlDatRx --command=cron:crawlDataRx
php artisan make:console CrawDataRx
Create console and command:
php artisan make:console CrawlDatRx --command=cron:crawlDataRx
Or You can create console only and then edit this line in Console class:
class CrawlDataRx extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'cron:crawlDataRx';
...
We can use Model in Console class and code like in Controller.
In handle() function we can write logic here or just call self::function_name() or $this->function_name()
Output to command (git-bash or cmd):
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->info('Start crawling...');
self::crawlUserData();
$this->info('Crawl done.');
}
Comments
Post a Comment