Hi, this is for Excel -- https://laravel-excel.com/
And this will help you with selecting data - https://webdevetc.com/programming-tricks/laravel/laravel-eloquent/how-to-select-all-rows-for-a-certain-month-or-day-year-or-time-using-eloquent
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, I am building an application with financial records. My client wants to be able to select a Month and have those "slips" show and have just those exported to an excel.
I currently have a month_id for the slips, and the months are entered manually. Is there a way to have a dropdown with the months and when toggled the table will find the month_id and show only that data? I have tried numerous things and find myself to be still a noob with this. Also how does one export that months data to an excel or pdf?
Hi @ladydeathkzn,
With this query you can get the months from the database to an array.
$months = DB::table("your_table_name_with_the_financial_records")
->select(DB::raw('monthname(created_at) AS month'))
->orderBy('created_at')
->groupBy(DB::raw('month'))
->get()
->toArray();
dd($months);
Please or to participate in this conversation.