clrghouz/app/Traits/UserSwitch.php

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;
}
}