Laravel 5.8 作业参数太少错误
Laravel 5.8 Too few arguments error for jobs
我在失败的作业中收到以下错误 table。
Too few arguments to function App\Jobs\updateTeamToDoProgress::handle(), 0 passed and exactly 1 expected in /var/www/eu_dash_laravel_dev/laravel/app/Jobs/updateTeamToDoProgress.php:32
我花了很多时间从其他人那里寻找相同问题的解决方案,但无法弄清楚我的代码中有什么问题。
namespace App\Jobs;
use App\Http\Controllers\ToDoController;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
class updateTeamToDoProgress implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $tries = 5;
protected $trip_id;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($trip_id)
{
$this->trip_id = $trip_id;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
echo ToDoController::updateTeamToDoProgress($this->trip_id);
}
}
使用 dispatch(new App\Jobs\updateTeamToDoProgress(172));
调度
帮忙?我做错了什么?
你的工作class是正确的。
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
echo ToDoController::updateTeamToDoProgress($this->trip_id);
}
您可以尝试更改控制器中的调度语法:
改为:
dispatch(new YourJobClass(172));
尝试:
$this->dispatch(new YourJobClass(172));
我在失败的作业中收到以下错误 table。
Too few arguments to function App\Jobs\updateTeamToDoProgress::handle(), 0 passed and exactly 1 expected in /var/www/eu_dash_laravel_dev/laravel/app/Jobs/updateTeamToDoProgress.php:32
我花了很多时间从其他人那里寻找相同问题的解决方案,但无法弄清楚我的代码中有什么问题。
namespace App\Jobs;
use App\Http\Controllers\ToDoController;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
class updateTeamToDoProgress implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $tries = 5;
protected $trip_id;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($trip_id)
{
$this->trip_id = $trip_id;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
echo ToDoController::updateTeamToDoProgress($this->trip_id);
}
}
使用 dispatch(new App\Jobs\updateTeamToDoProgress(172));
帮忙?我做错了什么?
你的工作class是正确的。
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
echo ToDoController::updateTeamToDoProgress($this->trip_id);
}
您可以尝试更改控制器中的调度语法:
改为:
dispatch(new YourJobClass(172));
尝试:
$this->dispatch(new YourJobClass(172));