public function memberUpdate(Request $request) { $id = (int) Request::segment(3); $action = Request::segment(4); //Form post data handling if (Request::isMethod('post')) { $validator = Validator::make(Input::all(), User::$memberUpdaRules); if ($validator->passes()) { if (User::updateMember($request, $id)) { return Redirect::to('users/member/' . $id . '/update')->with('message', 'The following errors occurred')->withErrors('Updated successfully')->with('flag', 'success'); } else { return Redirect::to('users/member/' . $id . '/update')->with('message', 'The following errors occurred')->withErrors('Update failed')->with('flag', 'danger'); } } else { return Redirect::to('users/member/' . $id . '/update')->with('message', 'The following errors occurred')->withErrors($validator)->withInput()->with('flag', 'danger'); } } //if the form is not submitted $member = User::find($id); $allroles = Role::All(); if ($member) { return view('users/memberupdate', compact('member', 'allroles')); } return view('errors/404'); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $roles = Role::All(); $permissions = Permission::getAllLabels(); return view('admin.permission', ['roles' => $roles, 'permissions' => $permissions]); }