clrghouz/app/Traits/UserSwitch.php

31 lines
414 B
PHP
Raw Normal View History

2021-09-27 12:50:47 +00:00
<?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;
}
}