You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
728 B
30 lines
728 B
<?php |
|
|
|
namespace App\Http\Controllers\API\v1\AuthApi; |
|
|
|
use Illuminate\Http\Request; |
|
use App\Http\Controllers\Controller; |
|
use PHPOpenSourceSaver\JWTAuth\Facades\JWTAuth; |
|
|
|
class LogoutApiController extends Controller |
|
{ |
|
/** |
|
* Handle the incoming request. |
|
* |
|
* @param \Illuminate\Http\Request $request |
|
* @return \Illuminate\Http\Response |
|
*/ |
|
public function __invoke(Request $request) |
|
{ |
|
//remove token |
|
$removeToken = JWTAuth::invalidate(JWTAuth::getToken()); |
|
|
|
if ($removeToken) { |
|
//return response JSON |
|
return response()->json([ |
|
'success' => true, |
|
'message' => 'Logout Berhasil!', |
|
]); |
|
} |
|
} |
|
}
|
|
|