Exemplo n.º 1
0
 public function update($id)
 {
     if (Auth::hasPermission('update')) {
         try {
             $this->validator->validate(Input::get());
             // update role info
             $updated = $this->roles->update($id, Input::get('title'), Input::get('alias'));
             // update role permissions
             $this->roles->updatePermissions(Input::get('id'), Input::get('permissions'));
             return Response::json($updated);
         } catch (\Agency\Cms\Exceptions\InvalidRoleException $e) {
             return Response::json(['error' => $e->messages()], 400);
         }
     }
     throw new UnauthorizedException();
 }