File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,22 +13,6 @@ trait Authenticatable
1313 */
1414 protected $ rememberTokenName = 'remember_token ' ;
1515
16- /**
17- * Invalid other sessions for the current user.
18- *
19- * The application must be using the AuthenticateSession middleware.
20- *
21- * @param string $password
22- * @param string $attribute
23- * @return $this
24- */
25- public function logoutOtherDevices ($ password , $ attribute = 'password ' )
26- {
27- return tap ($ this ->forceFill ([
28- $ attribute => Hash::make ($ password )
29- ]))->save ();
30- }
31-
3216 /**
3317 * Get the name of the unique identifier for the user.
3418 *
Original file line number Diff line number Diff line change 44
55use RuntimeException ;
66use Illuminate \Support \Str ;
7+ use Illuminate \Support \Facades \Hash ;
78use Illuminate \Support \Traits \Macroable ;
89use Illuminate \Contracts \Session \Session ;
910use Illuminate \Contracts \Auth \UserProvider ;
@@ -533,6 +534,26 @@ protected function cycleRememberToken(AuthenticatableContract $user)
533534 $ this ->provider ->updateRememberToken ($ user , $ token );
534535 }
535536
537+ /**
538+ * Invalid other sessions for the current user.
539+ *
540+ * The application must be using the AuthenticateSession middleware.
541+ *
542+ * @param string $password
543+ * @param string $attribute
544+ * @return $this
545+ */
546+ public function logoutOtherDevices ($ password , $ attribute = 'password ' )
547+ {
548+ if (! $ this ->user ()) {
549+ return ;
550+ }
551+
552+ return tap ($ this ->user ()->forceFill ([
553+ $ attribute => Hash::make ($ password )
554+ ]))->save ();
555+ }
556+
536557 /**
537558 * Register an authentication attempt event listener.
538559 *
You can’t perform that action at this time.
0 commit comments