/**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function admin(AdminRequest $request)
 {
     // Clear all permission caches
     $roles = Role::all();
     foreach ($roles as $role) {
         Cache::forget($role->slug);
     }
     $data['permissions'] = Permission::all();
     return view('permissions.admin', $data);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(DestroyRequest $request, $id)
 {
     Role::findOrFail($id)->delete();
     return redirect('roles/admin')->with('message', 'Role destroyed.');
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit(AdminRequest $request, $id)
 {
     $data['user'] = User::findOrFail($id);
     $data['roles'] = Role::all();
     return view('users.edit', $data);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Role::create(['name' => 'Admin', 'slug' => 'admin'])->permissions()->sync(Permission::all()->lists('id')->toArray());
     Role::create(['name' => 'Editor', 'slug' => 'editor']);
 }