Exemplo n.º 1
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'));
 }
Exemplo n.º 2
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');
 }
Exemplo n.º 3
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']);
 }
Exemplo n.º 4
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.');
 }
Exemplo n.º 5
0
 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'));
 }
Exemplo n.º 6
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'));
 }
Exemplo n.º 7
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();
     }
 }
 /**
  * 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();
 }
Exemplo n.º 9
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');
 }
Exemplo n.º 10
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');
 }
Exemplo n.º 11
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();
 }
Exemplo n.º 12
0
 /**
  * API for adding a new role
  */
 public function apiRoleCreate(RoleRequest $request)
 {
     $role = Role::create($request->all());
     event(new RoleWasCreated($role));
 }
Exemplo n.º 13
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');
 }
Exemplo n.º 14
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');
 }