Example #1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $params = $request->all();
     $role = Role::find($id);
     $role->name = $params['name'];
     $role->save();
     RoleAuthorization::where('role_id', '=', $id)->delete();
     foreach ($params['authorizations'] as $v) {
         $roleAuthorizations = new RoleAuthorization();
         $roleAuthorizations->role_id = $role->id;
         $roleAuthorizations->authorization_id = $v;
         $roleAuthorizations->save();
     }
     return redirect()->action('Admin\\RoleController@show');
 }
Example #2
0
@section('navbar')
    <?php 
$user = Auth::user();
$authorizations = \App\Model\RoleAuthorization::where('role_id', '=', $user->role_id)->select('authorization_id')->get()->toArray();
$authList = [];
foreach ($authorizations as $auth) {
    $authList[] = $auth['authorization_id'];
}
?>
    <nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="index.html">SB Admin v2.0</a>
        </div>
        <!-- /.navbar-header -->

        <ul class="nav navbar-top-links navbar-right">

            <li class="dropdown">
                <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                    <i class="fa fa-user fa-fw"></i>  <i class="fa fa-caret-down"></i>
                </a>
                <ul class="dropdown-menu dropdown-user">
                    <li><a href="{{url('admin/logout')}}"><i class="fa fa-sign-out fa-fw"></i> Logout</a>
                    </li>
                </ul>