jeudi 19 avril 2018

Notify users if their account is going to expire in 5 days later - Laravel

There are many users buying premium account in my website. How can i select users in which their account expiration day is exactly in 5 days later and notify them about renew account ?

in app\console\kernel.php add below function but dont know how to code about time in query.

/**
 * Define the application's command schedule.
 */

protected function schedule(Schedule $schedule)
{
    // $schedule->command('inspire')
    //          ->hourly();
    $schedule->call(function () {

        $users = User::where('expiration_time', '=', Carbon::now()->addDays(5))->get();

        //Notify related user about account emigrations
        Notification::send($users, new AccountExpiration());

    })->daily();
}



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2vqEVHX
via IFTTT

Aucun commentaire:

Enregistrer un commentaire