Skip to content

Commit

Permalink
Update AuthenticationController.php
Browse files Browse the repository at this point in the history
  • Loading branch information
sangnguyenplus authored Oct 4, 2024
1 parent 0e3133f commit 777b7be
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Http/Controllers/AuthenticationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,20 @@ public function logout(Request $request, BaseHttpResponse $response)
*/
public function checkEmail(CheckEmailRequest $request, BaseHttpResponse $response)
{
$user = ApiHelper::newModel()->where('email', $request->input('email'))->first();

$data = [
'exists' => $user ? true : false,
];

if ($user) {
$data['user'] = [
'name' => $user->name,
'email' => $user->email,
];
}

return $response
->setData(['exists' => ApiHelper::newModel()->where('email', $request->input('email'))->exists()]);
->setData($data);
}
}

0 comments on commit 777b7be

Please sign in to comment.