Navanitha Moorthy :
So i want sent mail to user if the user didn't sign in the system for 15 days. How to implement that inside code. I have attache my code here.
if ($user->last_sign_in) {
$ableToSendMail = true;
}
Dilip Hirapara :
use Carbon
to parse your current date and compare it with diffInDays
use Carbon\Carbon
$last_sign_in = Carbon::parse($user->last_sign_in);
$DeferenceInDays = Carbon::parse(Carbon::now())->diffInDays($last_sign_in);
if($DeferenceInDays > 15){
$ableToSendMail = true;
}
by using a query.
$date = \Carbon\Carbon::today()->subDays(15);
$users = User::where('last_sign_in', '<=', $date)->get();