samedi 5 octobre 2019

search paginate laravel result

public function cari_user_status(Request $request) {

 $users = User::orderBy('created_at', 'DESC')->paginate(10);
     if (!empty($request->nama)) {
        $users = $users->where('name', $request->nama)->paginate();

    }


        return view('users.index',  compact('users'),);

} i have search function in controller but if search it's do not work and the code is

Method Illuminate\Database\Eloquent\Collection::paginate does not exist.

how to fix it?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire