-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9f8b6f3
commit 40b08f2
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace App\Http\Responses; | ||
|
||
use Illuminate\Http\JsonResponse; | ||
use Illuminate\Http\Request; | ||
use Laravel\Fortify\Contracts\LogoutResponse as LogoutResponseContract; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use DB; | ||
use App\Models\UserDumpLog; | ||
|
||
|
||
class LogoutResponse implements LogoutResponseContract | ||
{ | ||
/** | ||
* Create an HTTP response that represents the object. | ||
* | ||
* @param Request $request | ||
* | ||
* @return Response | ||
*/ | ||
public function toResponse($request) | ||
{ | ||
UserDumpLog::update( | ||
[ | ||
'loggedout_at' => now(), | ||
], | ||
[ | ||
'_token' => $request->session()->token(), | ||
'action_type' => 'login' | ||
] | ||
); | ||
return $request->wantsJson() | ||
? new JsonResponse('', 204) | ||
: redirect()->route('login'); | ||
} | ||
} |
This file contains 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