/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(Request $request) { $allcrop = Crop::orderBy('name'); $crop_name = $request->input('name'); if (!empty($crop_name)) { $allcrop->Where('name', 'LIKE', '%' . $crop_name . '%'); } $allcrop = $allcrop->paginate(10); return view('frontend.CropList', compact('allcrop')); }