Php Laravel 5.7-在一定时间后杀死工匠

Php Laravel 5.7-在一定时间后杀死工匠,php,laravel,Php,Laravel,我正在开发一个laravel 5.7应用程序 我已创建一个命令,该命令应设置我的数据库: <?php namespace App\Console\Commands; use Illuminate\Console\Command; use Illuminate\Support\Facades\Artisan; class TestSetupCommand extends Command { protected $signature = 'test:data'; pro

我正在开发一个
laravel 5.7
应用程序

我已创建一个命令,该命令应设置我的数据库:

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;

class TestSetupCommand extends Command
{
    protected $signature = 'test:data';

    protected $description = 'Basic Setup for Test Data';

    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        Artisan::call('migrate:refresh', ['--seed' => '']);
        Artisan::call('basis:cc');
        Artisan::call('tick:exchange');

        $this->info("DB freshly setup: DONE");
        $this->info("Coin: DONE");
        $this->info("Exchange Scrapped: DONE");
    }
}

我认为最好的方法是将这些命令提取到后台作业中。然后,此artisan命令将成为将新作业排队的代码

为什么??通过覆盖如下值,可以非常轻松地进行配置:

<?php

namespace App\Jobs;

class ProcessPodcast implements ShouldQueue
{
    /**
     * The number of seconds the job can run before timing out.
     *
     * @var int
     */
    public $timeout = 120;
}

如何执行
基础:cc
勾选:交换
?他们是否访问数据库、API等?可能会在这些命令中添加限制参数。例如
artisan basis:cc--limit 100
仅加载前100项,然后停止。