/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(RoleRequest $request) { $role = new Role(); $role->fill($request->all()); $role->name = snake_case($request->display_name); $role->save(); $role->attachPermissions($request->permissions); return redirect()->route('rol.index'); }
public function store(RoleRequest $request) { if (!Helper::getMode()) { return redirect()->back()->withErrors(config('constants.DISABLE_MESSAGE')); } $role = new Role(); $data = $request->all(); $role->fill($data); $role->save(); return redirect('/configuration#permission')->withSuccess(config('constants.ADDED')); }
/** * Add a new role * * @return View */ public function do_addRole() { /** Role $role */ $role = new Role(); // Populate data from old request $role->fill(Request::old()); // Share View Variables View::share('role', $role); View::share('_pageName', 'Add Role'); View::share('_title', 'Add Role'); View::share('_pageAction', '/Admin/createRole'); // Render the template return $this->_renderTemplate('Admin.Role'); }
/** * save. * * @param Role $role role * @param Request $input 输入 */ public function savePost($role, $input) { $role->fill($input); return $role->save(); }