/**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     try {
         Permission::destroy($id);
     } catch (\Exception $e) {
         return \Redirect::back()->withErrors('You cannot delete this item, it may has information attached to it. Please remove that information first');
     }
     return \Redirect::route('permissions.index')->with('flash_message', 'Role has been removed.');
 }
 protected function getPermissions()
 {
     return Permission::with('roles')->get();
 }
Example #3
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     return view('roles.edit')->withRoles(Role::find($id))->withPermissions(Permission::all())->withUsers(User::all());
 }