/** * Update the specified resource in storage. * * @param int $id * @param UpdateRoleRequest $request * @return Response */ public function update($id, RoleRequest $request) { $role = Role::findOrFail($id); $role->update($request->all()); Flash::success('Изменения успешно сохранены.'); return redirect()->route('admin.roles.index'); }
public function update(RoleRequest $request, $id) { $data = $request->all(); $model = Role::find($id); autoAssignDataToProperty($model, $request->all()); $model->save(); return redirect()->action('Admin\\RoleController@index')->withSuccess(Lang::get('messages.update_success')); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(RoleRequest $request, $id) { $role = Role::findOrFail($id); $role->name = $request->get('name'); $role->save(); $role->syncPermission($request->get('permissions', [])); \Notification::success('acl.roles.update.success'); return redirect()->route('admin.roles.index'); }
/** * Update the specified resource in storage. * * @param Request $request * @param int $id * * @return Response */ public function update(RoleRequest $request, $id) { $input = $request->except('permissions'); $record = $this->model->findOrFail($id); $record->syncPermissions($request->permissions); $record->update($input); $this->notify(['type' => 'success', 'title' => 'Successful update!', 'description' => 'This role is updated successfully.']); return redirect()->back(); }
public function update($id, RoleRequest $request) { $this->role->save($id, $request->all()); if ($request->ajax()) { return response()->json(['status' => trans('messages.saved'), 'type' => 'success']); } $route = $request->get('task') == 'apply' ? route('admin.roles.edit', $id) : route('admin.roles.index'); return redirect($route)->with(['status' => trans('messages.saved'), 'type' => 'success']); }
public function update(RoleRequest $request, Role $role) { if (!Helper::getMode()) { return redirect()->back()->withErrors(config('constants.DISABLE_MESSAGE')); } $role->display_name = $request->input('display_name'); $role->save(); return redirect('/configuration#permission')->withSuccess(config('constants.UPDATED')); }
/** * Method for stroring a new role in the database. * * @param RoleRequest $request * @return mixed */ public function store(RoleRequest $request) { $role = new Role($request->all()); $role->save(); if (is_null($request->get('permissions'))) { $role->permissions()->sync([]); } else { $role->permissions()->sync($request->get('permissions')); } return redirect(route('rbac.roles.index'))->withSuccess('You have successfully created a new role.'); }
/** * Store a newly created resource in storage. * * @return \Illuminate\Http\Response */ public function store(RoleRequest $request) { // Check authorisation and throw 404 if not if (!$this->authorised('create')) { return view('errors/404'); } // Create Leave Role::create($request->all()); Toastr::success("Created new role", "Success"); $roles = Role::all(); return view('manage/role/list', compact('roles')); }
/** * Update a Role. * * @param RoleRequest $request * @param int $rid * @return Response */ public function update(RoleRequest $request, $rid) { try { $role = Role::find($rid); if (!$role) { return response()->error(404, 'Role Not Found'); } $role->fill($request->all()); $role->save(); return response()->success(); } catch (Exception $e) { return response()->error(); } }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(RoleRequest $request, $id) { $role = Role::findOrFail($id); $role->fill($request->all()); $role->name = snake_case($request->display_name); $role->save(); $role->perms()->sync($request->permissions); return redirect()->route('rol.index'); }
public function update($id, RoleRequest $request) { Role::find($id)->update($request->only('role_type_id')); }
/** * Update the specified resource in storage. * * @param RoleRequest $request * @param $roleId * @return \Illuminate\Http\JsonResponse */ public function update(RoleRequest $request, $roleId) { Role::findOrFail($roleId)->update($request->all()); return $this->response->noContent(); }
/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update($id, RoleRequest $request) { $role = Role::findOrFail($id); $role->update($request->all()); return redirect('roles'); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(RoleRequest $request) { $action = DB::transaction(function () use($request) { try { $role = Role::create($request->all()); Flash::success('Rol \'' . $request['name'] . '\' is succesvol toegevoegd'); } catch (\Exception $e) { Flash::error('Niet gelukt: ' . $e->getMessage()); //send mail with subject "db import failed" and body of $e->getMessage() } }); return redirect()->route('admin::role.all.index'); //return redirect('user.index'); }
/** * API for adding a new role */ public function apiRoleCreate(RoleRequest $request) { $role = Role::create($request->all()); event(new RoleWasCreated($role)); }
/** * Function Store * to Save/Update Brand From Brand Form * @Request @Name,@Code etc * * @return json */ public function onStore(\App\Http\Requests\RoleRequest $request) { $is_exist = \App\Models\Role::where('name', $request->get('name'))->where('id', '!=', $request->get('id'))->get(['id'])->first(); if ($is_exist) { $param['error'] = true; $param['message'] = Lang::get('message.role unique name'); return json_encode($param); } $role = new \App\Models\Role(); if ($request->has('id')) { $role = $role->where('id', $request->get('id'))->first(); $role->updated_at = date('Y-m-d H:i:s'); $role->updated_by = Auth::user()->id; } else { $role->created_at = date('Y-m-d H:i:s'); $role->created_by = Auth::user()->id; } $role->name = $request->get('name'); $role->description = $request->get('description'); $role->active = $request->get('active') ? $request->get('active') : 0; $role->authorize = $request->get('authorize') ? $request->get('authorize') : 0; $role->save(); $param['message'] = $request->get('id') ? Lang::get('info.updated') : Lang::get('info.inserted'); $param['error'] = false; return json_encode($param); }
public function update($id, RoleRequest $request) { $tasks = $request->input('tasks'); foreach ($tasks as $task) { $data = []; $userGroupRole = new UserGroupRole(); if (isset($task['list']) && $task['list'] == 1) { $data['list'] = 1; } else { $data['list'] = 0; } if (isset($task['view']) && $task['view'] == 1) { $data['view'] = 1; } else { $data['view'] = 0; } if (isset($task['add']) && $task['add'] == 1) { $data['add'] = 1; } else { $data['add'] = 0; } if (isset($task['edit']) && $task['edit'] == 1) { $data['edit'] = 1; } else { $data['edit'] = 0; } if (isset($task['delete']) && $task['delete'] == 1) { $data['delete'] = 1; } else { $data['delete'] = 0; } if (isset($task['report']) && $task['report'] == 1) { $data['report'] = 1; } else { $data['report'] = 0; } if (isset($task['print']) && $task['print'] == 1) { $data['print'] = 1; } else { $data['print'] = 0; } if ($data['view'] || $data['add'] || $data['edit'] || $data['delete'] || $data['report'] || $data['print']) { $data['list'] = 1; } if ($task['ugr_id'] > 0) { $data['updated_by'] = Auth::user()->id; $data['updated_at'] = time(); $userGroupRole->where(['id' => $task['ugr_id']])->update($data); } else { $data['user_group_id'] = $id; $data['component_id'] = $task['component_id']; $data['module_id'] = $task['module_id']; $data['task_id'] = $task['task_id']; $data['created_by'] = Auth::user()->id; $data['created_at'] = time(); DB::table('user_group_roles')->insert($data); } } Session()->flash('flash_message', 'Role has been updated!'); return redirect('roles'); }
/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update(RoleRequest $request, $id) { $input = $request->all(); $role = Role::find($id); $role->update($input); //Assign permissions to roles if (isset($input['permissions_assg'])) { $role->permissions()->sync($input['permissions_assg']); } else { $role->permissions()->sync([]); } Session::flash('flash_message', trans('admin/roles.form.update_confirm')); return redirect()->back(); }
/** * Update roles * * @param App\requests\RoleRequest $request * @return Response */ public function postRoles(RoleRequest $request) { $this->role_gestion->update($request->except('_token')); return redirect('user/roles')->with('ok', trans('back/roles.ok')); }
/** * Apply the updates to our resource */ public function update($id, RoleRequest $request) { if (!(Entrust::hasRole(['support', 'admin']) || Entrust::can('role.edit'))) { return redirect()->route('home'); } Log::info('update: ' . $id, $request->all()); /* * Here we can apply any business logic required, * then change $request->all() to results. */ $input = $request->all(); $this->roleRepository->update($id, $input); return redirect()->route('role.index'); }