lundi 2 mars 2020

how can i make a request in laravel

i just my training job on an application that was developed by other company, and there is not comment on the apps and this is my first time i start to use the Laravel Framework, so i need to make a filter to look for the customers that they already subscribe on the apps, and i don't know how can i make the request on the apps and where i can show the result? thanks a lot guys for advance.

this is the function i found on the apps

public function ajaxsearch(Request $request){




 $client = $request->get('client',null) ;
 $date_depart = $request->get('date_depart',null) ;
 $date_arrivee = $request->get('date_arrivee',null) ;
 $chauffeur = $request->get('chauffeur',null) ;
 $status = $request->get('status',null) ;
 $query = Course::where('id','!=',0);

i add this variable to use the same function to add a search bar on the apps //$client_filter = $request->get('client',null);

// chercher for the customers from the Courses table
if($client){
   $courses = $query->Where('client_id', 'like', '%' . $client . '%');

}
// to search for customers they already have a courses with all information date time and adress of start and arrive on the filter i wanna to add
/*if($client_filter){
  $projets = $query->Where('client_id', '=' , $client . '%');
}
*/

if($date_depart){
   $courses = $query->Where('date_depart', 'like', '%' . $date_depart . '%');

}
if($date_arrivee){
   $courses = $query->Where('date_arrivee', 'like', '%' . $date_arrivee . '%');

}
if($chauffeur){
   $courses = $query->Where('user_id', 'like', '%' . $chauffeur . '%');

}
if($status){
   $courses = $query->Where('status', 'like', '%' . $status . '%');

}

// for the view of the customer
$courses = $query->where('id' -> input::get('client_id'),'nom_usage' -> input::get('nom_usage'))->get();
return view($this->views.'.search',compact('Courses'));


$courses = $query->orderBy('id','desc')->get();
    return view($this->views.'.search',compact('courses'));

}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire