Removing extra unneeded queries on role views

parent f79554db
...@@ -28,9 +28,7 @@ class RolesController extends BaseUserModuleController ...@@ -28,9 +28,7 @@ class RolesController extends BaseUserModuleController
*/ */
public function index() public function index()
{ {
$roles = $this->role->all(); return view('user::admin.roles.index');
return view('user::admin.roles.index', compact('roles'));
} }
/** /**
...@@ -61,17 +59,11 @@ class RolesController extends BaseUserModuleController ...@@ -61,17 +59,11 @@ class RolesController extends BaseUserModuleController
/** /**
* Show the form for editing the specified resource. * Show the form for editing the specified resource.
* *
* @param int $id
* @return Response * @return Response
*/ */
public function edit($id) public function edit()
{ {
if (!$role = $this->role->find($id)) { return view('user::admin.roles.edit');
return redirect()->route('admin.user.role.index')
->withError(trans('user::messages.role not found'));
}
return view('user::admin.roles.edit', compact('role'));
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment