/** * Show the application dashboard. * * @return \Illuminate\Http\Response */ public function conpage() { // Auth::user()-> // $roles = Role::select('id')->groupBy('id')->get(); $roles = Role::get(); $permissions = Permission::get(); // $roleperms = $roles->permissions->lists('id')->toArray(); // $role = Role::findOrFail(5); // dd($role->permissions->lists('id')); return view('control')->withRoles($roles)->withPermissions($permissions); // ->withRoleperms($roleperms); //<a href="#" class="list-group-item {{in_array($perm->id, $role->permissions->id) ? 'active' : ""}} ">{{ $perm->name }}</a> }
/** * Get all permissions as collection. * * @return \Illuminate\Database\Eloquent\Collection */ public function getAllPermissions() { return Permission::all(); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { Permission::destroy($id); return redirect()->route('admin.permission.index'); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $role = Role::findOrFail($id); $permissions = Permission::get(); return view("access.role.edit")->withRole($role)->withPerms($permissions); }