Skip to content

Commit

Permalink
add logoutOtherDevices to trait
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Mar 28, 2018
1 parent 13f732e commit 200fdc6
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Illuminate/Auth/Authenticatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Illuminate\Auth;

use Illuminate\Support\Facades\Hash;

trait Authenticatable
{
/**
Expand All @@ -11,6 +13,22 @@ trait Authenticatable
*/
protected $rememberTokenName = 'remember_token';

/**
* Invalid other sessions for the current user.
*
* The application must be using the AuthenticateSession middleware.
*
* @param string $password
* @param string $attribute
* @return $this
*/
public function logoutOtherDevices($password, $attribute = 'password')
{
return tap($this->forceFill([
$attribute => Hash::make($password)
]))->save();
}

/**
* Get the name of the unique identifier for the user.
*
Expand Down

0 comments on commit 200fdc6

Please sign in to comment.