More improvements to User Switch
This commit is contained in:
parent
ac867a2526
commit
55cbe4087c
@ -45,7 +45,7 @@
|
|||||||
<!-- Top Menu Items -->
|
<!-- Top Menu Items -->
|
||||||
@include('adminlte::layouts.partials.topmenu')
|
@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 -->
|
<!-- Menu Toggle Button -->
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||||
<!-- The user image in the navbar-->
|
<!-- The user image in the navbar-->
|
||||||
@ -69,7 +69,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
@if ($user->switched())
|
@if ($user->switched)
|
||||||
<a href="{{ url('/admin/switch/stop') }}" class="btn btn-default btn-flat" id="switch">
|
<a href="{{ url('/admin/switch/stop') }}" class="btn btn-default btn-flat" id="switch">
|
||||||
{{ trans('adminlte_lang::message.switchoff') }}
|
{{ trans('adminlte_lang::message.switchoff') }}
|
||||||
</a>
|
</a>
|
||||||
@ -101,4 +101,4 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
@ -18,7 +18,7 @@ class AdminController extends Controller
|
|||||||
|
|
||||||
public function switch_authorised()
|
public function switch_authorised()
|
||||||
{
|
{
|
||||||
return TRUE;
|
return Auth::user()->isAdmin ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function switch_session()
|
public function switch_session()
|
||||||
|
@ -9,7 +9,12 @@ use Session;
|
|||||||
|
|
||||||
trait UserSwitch
|
trait UserSwitch
|
||||||
{
|
{
|
||||||
public function switched()
|
public function GetIsAdminAttribute()
|
||||||
|
{
|
||||||
|
return isset($this->admin) ? $this->admin : FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSwitchedAttribute()
|
||||||
{
|
{
|
||||||
return Session::get('orig_user');
|
return Session::get('orig_user');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user