BookStack\User::getDefault PHP Метод

getDefault() публичный статический Метод

Returns the default public user.
public static getDefault ( ) : User
Результат User
    public static function getDefault()
    {
        return static::where('system_name', '=', 'public')->first();
    }

Usage Example

Пример #1
0
 /**
  * Controller constructor.
  */
 public function __construct()
 {
     // Get a user instance for the current user
     $user = auth()->user();
     if (!$user) {
         $user = User::getDefault();
     }
     // Share variables with views
     view()->share('signedIn', auth()->check());
     view()->share('currentUser', $user);
     // Share variables with controllers
     $this->currentUser = $user;
     $this->signedIn = auth()->check();
 }
All Usage Examples Of BookStack\User::getDefault