Ajoute la notification journalière

Il manque l'intégration du mail
Pour #13
This commit is contained in:
2020-03-20 16:37:36 +01:00
parent 3ab7e495e9
commit bd12cf6dfb
7 changed files with 208 additions and 10 deletions

View File

@@ -2,12 +2,11 @@
namespace App\Console;
use App\Console\Commands\SendDailyNotification;
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
{
@@ -17,7 +16,7 @@ class Kernel extends ConsoleKernel
* @var array
*/
protected $commands = [
//
SendDailyNotification::class,
];
/**
@@ -28,17 +27,17 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
$schedule
->command('send:daily')
->cron('0 */6 * * *');
$schedule->call(function() {
$users = User::where('email_verified_at', '!=', null)
->where('notification_hour', '!=', null)
$users = User::where('email_verified_at', '=', null)
->get();
var_dump(count($users));
foreach ($users as $user) {
dispatch((new SendReminderEmail($user)));
}
})->everyMinute();
// $schedule->command('inspire')
// ->hourly();
})->daily();
}
/**