Пример #1
0
 /**
  * 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');
 }
Пример #2
0
 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'));
 }
Пример #3
0
 /**
  * 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');
 }
Пример #4
0
 /**
  * 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();
 }
Пример #5
0
 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']);
 }
Пример #6
0
 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'));
 }
Пример #7
0
 /**
  * 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.');
 }
Пример #8
0
 /**
  * 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'));
 }
Пример #9
0
 /**
  * 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();
     }
 }
Пример #10
0
 /**
  * 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');
 }
Пример #11
0
 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();
 }
Пример #13
0
 /**
  * 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');
 }
Пример #14
0
 /**
  * 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');
 }
Пример #15
0
 /**
  * API for adding a new role
  */
 public function apiRoleCreate(RoleRequest $request)
 {
     $role = Role::create($request->all());
     event(new RoleWasCreated($role));
 }
Пример #16
0
 /**
  * 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);
 }
Пример #17
0
 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');
 }
Пример #18
0
 /**
  * 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();
 }
Пример #19
0
 /**
  * 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'));
 }
Пример #20
0
 /**
  * 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');
 }