/**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     //getting all point when no search is done
     $allpoint = FarmerPoint::orderBy('name');
     //listing for drop down search
     $farmerPointList = FarmerPoint::Lists('name', 'id');
     $districtList = District::Lists('name', 'id');
     //form data receiving
     $point_name = $request->input('id');
     $point_district = $request->input('district_id');
     $phone = $request->input('phone');
     if (!empty($phone)) {
         $allpoint->Where('phone', 'LIKE', '%' . $phone . '%');
     }
     if (!empty($point_name)) {
         //filtering allpoint with name
         $allpoint->Where('id', 'LIKE', '%' . $point_name . '%');
     }
     if (!empty($point_district)) {
         //filtering allpoint with district
         $allpoint->Where('district_id', $point_district);
     }
     $allpoint = $allpoint->paginate(10);
     return view('frontend.pointlist', ['allpoint' => $allpoint, 'farmerPointList' => $farmerPointList, 'districtList' => $districtList]);
 }
Ejemplo n.º 2
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     //listing all agent when no search is done
     $allagent = User::where('user_type_id', 2)->paginate(15);
     //listing for drop down menu
     $farmerPointList = FarmerPoint::Lists('name', 'id');
     //taking input from search field
     $agent_name = $request->input('name');
     $agent_phone = $request->input('phone');
     $agent_point = $request->input('id');
     //searching requested data
     if (!empty($agent_name)) {
         $allagent = User::where('user_type_id', 2)->where('name', 'LIKE', '%' . $agent_name . '%')->paginate(10);
     }
     if (!empty($agent_phone)) {
         $allagent = User::where('user_type_id', 2)->where('phone', 'LIKE', '%' . $agent_phone . '%')->paginate(10);
     }
     if (!empty($agent_point)) {
         $allagent = User::where('user_type_id', 2)->where('farmer_point_id', $agent_point)->paginate(10);
     }
     //updating allagent variable
     //$allagent=$allagent->paginate(10);
     return view('agent.AgentList', ['allagent' => $allagent, 'farmerPointList' => $farmerPointList]);
 }
Ejemplo n.º 3
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $farmerPointList = FarmerPoint::Lists('name', 'id');
     return view('Farmer.FarmerRegistration', ['farmerPointList' => $farmerPointList]);
 }