Exemplo n.º 1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $authorization = $this->authorizations->find($id);
     $modules = Module::lists('name', 'id');
     $roles = Role::lists('name', 'id');
     $communes = Perimeter::lists('nom_com', 'id');
     $epcis = Perimeter::lists('nom_epci', 'epci');
     $users = User::lists('username', 'id');
     return view('acl::admin.authorizations.edit', compact('authorization', 'modules', 'roles', 'communes', 'epcis', 'users'));
 }
Exemplo n.º 2
0
 public function terminate($request, $response)
 {
     $user_id = $request->user()->id;
     $authorizations = User::find($user_id)->authorizations()->get();
     foreach ($authorizations as $authorization) {
         $perim = array();
         foreach ($authorization->perimeters as $perimeter) {
             array_push($perim, $perimeter->id);
         }
         $auth[$authorization->module->slug][$authorization->role->slug] = $perim;
     }
     $request->session()->put('auth', $auth);
 }