【发布时间】:2015-09-17 18:21:18
【问题描述】:
我已将我的命令注册为php artisan run:process,它看起来像
class queuedTransaction extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'run:process';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Running the queued transaction.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle(){
DB::table('transfers')->truncate();
}
}
这是我的kernel.php
class Kernel extends ConsoleKernel
{
protected $commands = [
\App\Console\Commands\Inspire::class,
\App\Console\Commands\queuedTransaction::class,
];
protected function schedule(Schedule $schedule)
{
$schedule->command('run:process')->everyMinute();
}
}
现在我想每分钟运行一次php artisan run:process 并截断transfers 表,但cron 现在不起作用。为了确保command 本身是否正常工作,我将command 放入我的routes 并调用它,它的截断表含义命令正在发挥作用。
【问题讨论】: