CopyPastor

Detecting plagiarism made easy.

Score: 2; Reported for: String similarity, Exact paragraph match Open both answers

Possible Plagiarism

Reposted on 2018-10-12
by Koushik Das

Original Post

Original - Posted on 2018-10-12
by Koushik Das



            
Present in both answers; Present only in the new answer; Present only in the old answer;

Make sure that in `User` model, you have this imported
use Laravel\Passport\HasApiTokens;
and you're using the trait `HasApiTokens` using
use HasApiTokens inside the user class. Now you create the log out route and in the controller, do this
$user = Auth::user()->token(); $user->revoke(); return 'logged out'; // modify as per your need
This will log the user out from the current device where he requested to log out. If you want to log out from all the devices where he's logged in. Then do this instead
DB::table('oauth_refresh_tokens') ->where('user_id', Auth::user()->id) ->update([ 'revoked' => true ]); This will log the user out from everywhere. This really comes into help when the user changes his password using reset password or forget password option and you have to log the user out from everywhere.
Make sure that in `User` model, you have this imported
use Laravel\Passport\HasApiTokens;
and you're using the trait `HasApiTokens` using
use HasApiTokens inside the user class. Now you create the log out route and in the controller, do this
$user = Auth::user()->token(); $user->revoke(); return 'logged out'; // modify as per your need
This will log the user out from the current device where he requested to log out. If you want to log out from all the devices where he's logged in. Then do this instead
DB::table('oauth_refresh_tokens') ->where('user_id', Auth::user()->id) ->update([ 'revoked' => true ]); This will log the user out from everywhere. This really comes into help when the user changes his password using reset password or forget password option and you have to log the user out from everywhere.

        
Present in both answers; Present only in the new answer; Present only in the old answer;