How to can print user using search filter functionality?

Posted 2 years ago by vipin93

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 sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.