Home > Mobile >  laravel get data in view table if due date having 3 day
laravel get data in view table if due date having 3 day

Time:04-11

im tying to get data in view table if next payment date near 3days i need to get data in view table

example next due date 15-4-2022 current date 11-4-2022 //Carbon::now

if date having near to 3days show data in table //name

if not then don't show any thing

Payment::select( 'next_due_date')->whereDate('next_due_date', Carbon::now)->get();

CodePudding user response:

Please try this one:

//if your payment date is 15-4-2022 then you have to add 4 days in carbon objects.
 $dueDate = Carbon::now()->addDays(4);
 Payment::select( 'next_due_date')->whereDate('next_due_date', $dueDate)->get();

//or

 Payment::select( 'next_due_date')->whereDate('next_due_date', date('Y-m-d', strtotime("4 days")))->get();

  • Related