More improvements to User Switch

This commit is contained in:
Deon George 2018-07-17 13:27:25 +10:00
parent ac867a2526
commit 55cbe4087c
No known key found for this signature in database
GPG Key ID: 7670E8DC27415254
3 changed files with 10 additions and 5 deletions

View File

@ -45,7 +45,7 @@
<!-- Top Menu Items -->
@include('adminlte::layouts.partials.topmenu')
<li class="dropdown user user-menu @if($user->switched()) bg-red @endif" id="user_menu">
<li class="dropdown user user-menu @if($user->switched) bg-red @endif" id="user_menu">
<!-- Menu Toggle Button -->
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<!-- The user image in the navbar-->
@ -69,7 +69,7 @@
</div>
<div class="pull-right">
@if ($user->switched())
@if ($user->switched)
<a href="{{ url('/admin/switch/stop') }}" class="btn btn-default btn-flat" id="switch">
{{ trans('adminlte_lang::message.switchoff') }}
</a>
@ -101,4 +101,4 @@
</ul>
</div>
</nav>
</header>
</header>

View File

@ -18,7 +18,7 @@ class AdminController extends Controller
public function switch_authorised()
{
return TRUE;
return Auth::user()->isAdmin ? TRUE : FALSE;
}
public function switch_session()

View File

@ -9,7 +9,12 @@ use Session;
trait UserSwitch
{
public function switched()
public function GetIsAdminAttribute()
{
return isset($this->admin) ? $this->admin : FALSE;
}
public function getSwitchedAttribute()
{
return Session::get('orig_user');
}