🎨 Tente d'ajouter le rappel journalier

This commit is contained in:
Shikiryu
2019-09-25 16:08:50 +02:00
parent 70afcacd21
commit 333f6feafb
4 changed files with 91 additions and 0 deletions

View File

@@ -2,8 +2,12 @@
namespace App\Console;
use App\Jobs\SendReminderEmail;
use App\Jobs\SendWelcomeEmail;
use App\User;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Illuminate\Support\Carbon;
class Kernel extends ConsoleKernel
{
@@ -24,6 +28,15 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
$schedule->call(function() {
$users = User::where('email_verified_at', '!=', null)
->where('notification_hour', '!=', null)
->get();
var_dump(count($users));
foreach ($users as $user) {
dispatch((new SendReminderEmail($user)));
}
})->everyMinute();
// $schedule->command('inspire')
// ->hourly();
}