我正在Laravel中建立一个cronjob,但是它没有运行。我要求服务器的提供商检查此问题。他说错误即将到来“找不到PHP致命错误类illuminate \ console \ command”,但是我在目录(/ public_html / vendor / laravel / framework / src / Illuminate / Console)中有command.php文件。然后我错过了什么,如何解决此问题以及如何测试自己的问题。提前感谢。
cronJobForSubscription.php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Model;
class cronJobForSubscription extends Command
{
protected $signature = 'command:update';
protected $description = 'Command description';
public function __construct()
{
parent::__construct();
}
public function handle()
{
Model::udpate(['updated'=>1]);
}
}
Kernel.php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
protected $commands = [
'App\Console\Commands\cronJobForSubscription'
];
protected function schedule(Schedule $schedule)
{
$schedule->command('command:update')
->dailyAt('18:20');
}
protected function commands()
{
require base_path('routes/console.php');
}
}