/** * Updates the specified user. * * @param UpdateRequest $request * @param int|string $id * * @return bool|User */ public function update(UpdateRequest $request, $id) { $attributes = ['username' => $request->input('username'), 'email' => $request->input('email'), 'first_name' => $request->input('first_name'), 'last_name' => $request->input('last_name'), 'permissions' => $request->input('permissions', []), 'activated' => $request->input('activated', false)]; $user = $this->sentry->update($id, $attributes); if ($user) { return $user; } return false; }
/** * Processes updating a user. * * @param int|string $id * * @return bool|\Illuminate\Support\Collection|null|static */ public function update($id) { try { $this->dbStartTransaction(); /* * Update the user through Sentry first */ $this->sentry->update($id, $this->input); /* * Now we'll update the extra user details Sentry * doesn't manage */ $user = $this->model->find($id); $insert = ['first_name' => $this->getInput('first_name'), 'last_name' => $this->getInput('last_name')]; if ($user->update($insert)) { $this->dbCommitTransaction(); return $user; } } catch (\Exception $e) { $this->dbRollbackTransaction(); } return false; }