What happens is that I want to send two parameters by means of a json in ajax to the laravel driver, but I do not have the slightest idea of how to select to receive the parameters, I would like them to help me with it Here I leave my driver code
if ($request->ajax()) {
if ($request->granja != null && $request->lote != null) {
$collection = Precebo::join('granjas','granjas.id','=','formulario_precebo.granja_id')
->select('granjas.nombre_granja', DB::raw('avg(conversion_ajust_fin)'))
->where()
->whereBetween('formulario_precebo.fecha_destete',[$request->desde,$request->hasta])
->groupBy('granjas.nombre_granja')->get();
}
$arrayT = [];
foreach ($collection as $value) {
$arrayT[] = [$value->nombre_granja,$value->total];
}
return response()->json(['status'=>'success','data'=>$arrayT],200);
}else{
abort(402);
}
I do not know how to make that select to receive the two parameters