Last active
June 18, 2020 09:43
-
-
Save pipethedev/27d7a2ed43d943c9f58afd14d4fdd2cd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App\Http\Controllers\Auth; | |
| use App\Http\Controllers\Controller; | |
| use Illuminate\Http\Request; | |
| use Auth; | |
| class SignInController extends Controller | |
| { | |
| public function __invoke(Request $request){ | |
| $credentials = request(['email', 'password']); | |
| if (!$token = Auth::attempt($credentials)) { | |
| return response()->json(['error' => 'Unauthorized'], 401); | |
| } | |
| return response()->json(compact('token')); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment