Level 54
why not you run it and let us know the result?
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
I create api for login that returns username and message retrieved user successfully:
public function index(Request $request)
{
$data = $request->all();
$data['email'] = $request->email;
$password = bcrypt($request->password);
$User = User::where('email', $data['email']) and where('password', $password)->get();
if($User != null){
return $this->sendResponse($data->toArray(), 'Users retrieved successfully');
}
}
I am not sure if I write this line correctly:
$User = User::where('email', $data['email']) and where('password', $password)->get();
please help me correct it?
Please or to participate in this conversation.