Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $email = $request->input('email');
- $password = $request->input('password');
- $user = User::where('email', $email)->first();
- if ($user) {
- if (Hash::check($password, $user->password)) {
- $token = $this->JWTAuth->fromUser($user);
- return response()->json(['token' => $token, 'user' => $user], 200);
- }
- }
- return 'FAIL';
- /*abaixo o modo que eu crio o hash para o campo password*/
- $user->fill([
- 'password' => Hash::make($password)
- ])->save();
- if ($user && Hash::check($password, $user->password)) {
- return 'Ok, all good!';
- }
- return 'You shall not pass!';
- $user = User::where('email', $email)->get();
- if ($user->first()) {
- if (Hash::check($password, $user->password)) {
- $token = $this->JWTAuth->fromUser($user);
- return response()->json(['token' => $token, 'user' => $user], 200);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement