Reputation: 2166
I tried the code below, but didn't work.
$susbcribers = DB::table('subscribers')
->select(
DB::raw("DATE_FORMAT(Carbon::now()->subDate(subscribers.expired_at), '%d') as days_left"),
)->get();
I just want to get the days left, but now I'm stuck with this. I am just beginner of Laravel, somebody help me of this, would appreciate any suggestion/advice, thanks in adv..
Upvotes: 0
Views: 671
Reputation: 8750
I think this should do the trick.
$susbcribers = DB::table('subscribers')
->select(DB::raw("DATEDIFF(now(), expired_at) as days_left"))
->get();
Upvotes: 1