What do you have in your kernel.php
And format your code with three backticks ``` before and after your code block
You can go back and edit your original question.
I use laravel 10. In my application I have a job and schedule. When I run the commands:
php artisan schedule:list php artisan schedule:run
I get this error:
Too few arguments to function App\Jobs\SendNewsletter::__construct(), 0 passed in C:\xampp\htdocs\project\app\Console\Kernel.php on line 17 and exactly 1 expected
this is my controller:
$letters=Newsletter::orderBy('id','asc')->chunk(2, function($letters){
$this-> dispatch(new SendNewsletter($letters));
});
In App\Jobs\SendNewsletter
public $letters;
public function __construct($letters)
{
$this->letters=$letters;
}
In app\Console|kernel.php
use App\Jobs\SendNewsletter;
protected function schedule(Schedule $schedule): void
{
$schedule->job(new SendNewsletter)->weekly();
}
Everything looks fine but it keeps throwing an error and The schedule isn't working either.
Please or to participate in this conversation.