/**
  * 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'));
 }
 public function update($inputs, $id)
 {
     $authorization = $this->model->find($id);
     $authorization->fill($inputs);
     $authorization->save();
     $authorization->users()->sync($inputs['user']);
     if (isset($inputs['com'])) {
         $authorization->perimeters()->sync($inputs['com']);
     }
     if (isset($inputs['epci'])) {
         $perim = Perimeter::select('id')->whereIn('epci', $inputs['epci'])->get();
         $authorization->perimeters()->sync($perim);
     }
 }
Example #3
0
 public function searchperim()
 {
     $userperim = Perimeter::whereIn('id', $this->perim())->get();
     return $userperim;
 }