Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

if not then don’t show any thing

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

>Solution :

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();

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading