/** * Show the form for editing the specified resource. * * @param int $id * * @return Response */ public function edit($id) { $role = Role::findOrFail($id); $permission_role = Role::find($id)->permissions()->lists('permission_id')->toArray(); $permissions = Permission::lists('display_name', 'id'); return view('admin.roles.edit', compact('role', 'permissions', 'permission_role')); }
public function ComposeWebPanelForms() { view()->composer('templates.' . \Config::get('webpanel.template') . 'webpanel.store.items._form', function ($view) { $view->with('categories', StoreCategory::lists('display_name', 'id')); $view->with('servers', StoreServer::lists('display_name', 'id')); }); view()->composer('templates.' . \Config::get('webpanel.template') . 'webpanel.store.categories._form', function ($view) { $view->with('servers', StoreServer::lists('display_name', 'id')); }); view()->composer('templates.' . \Config::get('webpanel.template') . 'webpanel.panel.users._form', function ($view) { $view->with('roles', Role::lists('display_name', 'id')); }); view()->composer('templates.' . \Config::get('webpanel.template') . 'webpanel.panel.roles._form', function ($view) { $view->with('permissions', Permission::lists('display_name', 'id')); }); view()->composer('templates.' . \Config::get('webpanel.template') . 'webpanel.panel.permissions._form', function ($view) { $view->with('roles', Role::lists('display_name', 'id')); }); }
/** * Run the migrations. * * @return void */ public function up() { // Inserts the Permissions Permission::insert($this->permissions); // Creates a root admin role $rootadmin = new Role(); $rootadmin->name = "rootadmin"; $rootadmin->display_name = "Root Admin"; $rootadmin->description = "Has Permissions to do everything in the WebPanel"; $rootadmin->save(); //Get all permissions $ids = Permission::lists('id')->all(); //Sync them to the rootadmin $rootadmin->perms()->sync($ids); //Creates an admin user $admin = new User(); $admin->name = 'admin'; $admin->email = '*****@*****.**'; $admin->password = bcrypt('password'); $admin->save(); $admin->roles()->sync(array($rootadmin->id)); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $title = $this->title; $module_name = $this->module_name; $module_name_singular = str_singular($this->module_name); $module_icon = $this->module_icon; $module_action = "Edit"; ${$module_name_singular} = Role::findOrFail($id); $permissions = Permission::lists('name', 'id'); return view("backend.{$module_name}.edit", compact('module_name', "{$module_name_singular}", 'module_icon', 'module_action', 'title', "permissions")); }
public function create() { $role = new Role(); $relations = Permission::lists('name', 'id'); return view('entrust.roles.create', compact('role', 'relations')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit(Request $request, $id) { $user = User::where('id', $id)->first(); if ($user && ($user->id == $request->user()->id || $request->user()->hasPermission('admin'))) { $permissions = Permission::lists('name', 'id'); $user_permissions = $user->permissions()->getRelatedIds()->all(); return view('users.edit')->with('user', $user)->with('permissions', $permissions)->with('user_permissions', $user_permissions); } else { return redirect('/home')->withErrors('You do not have sufficient permissions'); } }
public function lists($value, $key = '') { return \App\Permission::lists($value, $key); }
protected function getPermissions() { return Permission::lists('label', 'id')->toArray(); }
/** * Form for editing an existing role with the given id is shown with this method. * * @param $id * @return \Illuminate\View\View */ public function edit($id) { $role = Role::find($id); $permissions = Permission::lists('name', 'id'); return view('rbac-gui.roles.edit', compact('role', 'permissions')); }
public function create() { $permission = new Permission(); $relations = Permission::lists('name', 'id'); return view('entrust.permissions.create', compact('permission', 'relations')); }