Exemplo n.º 1
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $permission = Permission::with('groups')->findOrFail($id);
     $permission->groups->sortBy('route');
     $permissions = Permission::orderBy('route')->get();
     return View::make('sysguard::resource.permission.show', compact('permission', 'permissions'));
 }
Exemplo n.º 2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $group = Group::with(array('menus' => function ($query) {
         $query->orderBy('name');
     }, 'permissions' => function ($query) {
         $query->orderBy('route');
     }))->findOrFail($id);
     $menus = Menu::orderBy('name')->get()->lists('name', 'id');
     $permissions = Permission::orderBy('route')->get()->lists('route', 'id');
     $groupMenus = $group->menus->lists('id');
     $groupPermissions = $group->permissions->lists('id');
     return View::make('sysguard::resource.group.edit', compact('group', 'menus', 'permissions', 'groupMenus', 'groupPermissions'));
 }