/** * Restore a soft deleted user. * * @param int $userId * * @return \Illuminate\Http\RedirectResponse */ public function restore($userId) { if (!($user = $this->users->findByKey($userId))) { return $this->notFound(); } $this->users->restore($user); return $this->redirect('edit', [$user->id])->with('success', Lang::get('c::user.restore-success')); }
/** * Delete an existing user. * * @param int $userId * * @return \Illuminate\Http\JsonResponse */ public function delete($userId) { if (!($user = $this->users->findByKey($userId))) { return $this->notFound(); } elseif ($this->users->delete($user)) { return $this->success(); } else { return $this->error('delete failed'); } }