1
I created this function in my Controller to return a list of employees in my ajax request, but it is not returning anything.
public function getFuncionarios(Request $request){
if($info = Funcionario::where('id_empresa', $request->get('empresa'))){
return response()->json($info);
}else{
return 'error';
}
}
When I return the direct variable does not work either.
return $info;
But if I put the where
to return only 1 record works.
$info = Funcionario::where('id_empresa', $request->get('empresa'))->first()
What can it be? What would be the right way to get the result I need? This list of employees would be to feed a <select>
.
very good also @Miguelbatista, only used in the case the WhereIdCompany to be according to the column name on my table and worked perfectly.
– Raylan Soares