With which Database Query do you have a problem?
My first ide go like this way:
Student::where('status',1)->where('created_at', [date('Y-m-d', strtotime($dt->month)])-get();
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Like I have filter functionality in my app where we can search users in specific year or class but problem is that how can print that like if I search for class Ma and I got total 25 students so how can print them.When I hit print button its print all student instead of only filter student
public function unpaid(Request $request)
{
$coursewise = $request->course;
$dt = Carbon::now();
if ($coursewise)
{
$sub = Student::where('status',1)->where('course_id',$coursewise)->whereDoesntHave('subscriptions', function ($query) use($dt) {
$query->whereMonth('created_at','=',$dt->month);
})->with('courses')->paginate(15);
}
else
{
$sub = Student::where('status',1)->whereDoesntHave('subscriptions', function ($query) use($dt) {
$query->whereMonth('created_at','=',$dt->month);
})->with('courses')->paginate(15);
}
$courses = DB::table("courses")->pluck("name","id");
if ($request->print)
{
$pdf=PDF::loadView('fee.printpdf',compact('sub','courses'));
return $pdf->stream($sub->student_name. '.' .'pdf');
}else
{
return view('search.search_unpaid',compact('sub','courses'));
}
Please or to participate in this conversation.