Answer the question
In order to leave comments, you need to log in
Why does Laravel swear when I pass a model in a job's constructor?
Good day.
There is an instance of Jobs\UpdateTable. There is a constructor.
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(Products $Model) // <-- путь корректен, я указал use
{
$this->Model = $Model; // если вот это убрать, все будет работать нормально
}
$schedule->job(Jobs\UpdateTable::class)->everyMinute();
namespace App;
use Illuminate\Database\Eloquent\Model;
class Products extends Model
{
//
}
$ php artisan schedule:run
// Вот это вот приведет к ошибке
// Illuminate\Database\Eloquent\ModelNotFoundException : No query results for model [App\Products]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question