I created a function in the controller that returns me the users where the user_anjo condition is equal to 1.
You are currently returning all of this user's data in json.
How can I do to return only the user's emails?
I tried something like:
public function avisarAnjos(Request $request){
$usuariosAnjos = User::where('usuario_anjo', '1')->get();
return response()->json($usuariosAnjos.email);
}
e:
public function avisarAnjos(Request $request){
$usuariosAnjos = User::where('usuario_anjo', '1')->get();
return response()->json($usuariosAnjos->email);
}
and
public function avisarAnjos(Request $request){
$usuariosAnjos = User::where('usuario_anjo', '1')->get();
return response()->json($usuariosAnjos['email']);
}