/**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $model = new Permission();
     $roles = Role::lists('acronym', 'id');
     $model_roles = [];
     return view($this->create_view, compact(['model', 'roles', 'model_roles']));
 }
Esempio n. 2
0
 public function listRoles()
 {
     return Role::lists('role_title', 'id')->toArray();
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function edit($id)
 {
     try {
         $model = $this->getModel($id);
         $roles = Role::lists('name', 'id');
         $model_roles = $model->roles->lists('id');
         $departments = Department::lists('name', 'id');
         $model_departments = $model->departments->lists('id');
         $users = User::where('id', '<>', $id)->withTrashed()->lists('display_name', 'id');
         return view($this->edit_view, compact(['model', 'roles', 'model_roles', 'departments', 'model_departments', 'users']));
     } catch (Exception $e) {
         Flash::warning(trans($this->resource_name . 'not_found', ['model' => $this->model_name, 'id' => $id]));
         return $this->index();
     }
 }