clrghouz/app/Traits/UserSwitch.php
2021-10-02 10:03:17 +10:00

31 lines
414 B
PHP

<?php
/**
* Check if users have been switched
*/
namespace App\Traits;
use Illuminate\Support\Facades\Session;
trait UserSwitch
{
/**
* Who is the original user
*
* @return mixed
*/
public function getSwitchedAttribute()
{
return Session::get('orig_user');
}
/**
* Is this user an admin
*
* @return bool
*/
public function isAdmin(): bool
{
return (bool)$this->admin ?? FALSE;
}
}