Skip to content

Commit

Permalink
Merge be40488 into 3e926cc
Browse files Browse the repository at this point in the history
  • Loading branch information
kresnasatya committed Jan 19, 2020
2 parents 3e926cc + be40488 commit a122583
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion app/Http/Controllers/Api/Auth/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@

class AuthController extends Controller
{

public function login(Request $request)
{
$request->validate([
'email' => 'required|string|email',
'password' => 'required|string|min:6',
]);

$form = [
'grant_type' => 'password',
'client_id' => config('services.passport.client_id'),
Expand All @@ -32,6 +38,8 @@ public function logout()
$token->revoke();
});

return response()->json('Logged out successfully', 200);
return response()->json([
'message' => 'Logged out successfully',
], 200);
}
}
2 changes: 1 addition & 1 deletion routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// I think it's better without conflict the main project.

Route::post('auth/login', 'Api\Auth\AuthController@login')->name('api.auth.login');
Route::middleware('auth:api')->post('logout', 'Api\Auth\AuthController@logout')->name('api.auth.logout');
Route::middleware('auth:api')->post('auth/logout', 'Api\Auth\AuthController@logout')->name('api.auth.logout');

Route::group(['middleware' => 'auth:api', 'as' => 'api.', 'namespace' => 'Api'], function () {
/*
Expand Down

0 comments on commit a122583

Please sign in to comment.