我创建了如下命令:
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class SchedulesCommand extends Command {
protected $name = "mod:check";
protected $description = "Checks the Database for any upcoming schedules.";
protected $mod;
public function __construct (Model $mod){
$this->mod = $mod;
}
public function fire(){
$this->line('Checking the database');
$this->mod->f1 = 1;
$this->mod->f2 = "test";
$this->mod->f3 = 'Command';
$this->mod->save();
}
?>
我收到以下错误-不知道为什么-
{"error":{"type":"ErrorException","message":"Invalid argument supplied for foreach()","file":"\/home\/test\/Documents\/account1\/PHP Scripts\/project\/vendor\/symfony\/console\/Symfony\/Component\/Console\/Application.php","line":409}}
有人可以告诉我可能出了什么问题吗?
这是我的artisan.php
文件:
$mod = new Model;
$artisan->add(new SchedulesCommand($mod));