6 characters", * type="string" * ) * ) * ) * ), * @OA\Response( * response=200, * description="The Company User response", * @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"), * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), * @OA\JsonContent(ref="#/components/schemas/CompanyUser"), * ), * @OA\Response( * response=422, * description="Validation error", * @OA\JsonContent(ref="#/components/schemas/ValidationError"), * ), * @OA\Response( * response="default", * description="Unexpected Error", * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) */ public function store(CreateAccountRequest $request) { $account = (new CreateAccount($request->all(), $request->getClientIp()))->handle(); if (! ($account instanceof Account)) { return $account; } MultiDB::findAndSetDbByAccountKey($account->key); $cu = CompanyUser::where('user_id', $account->users()->first()->id); $company_user = $cu->first(); $truth = app()->make(TruthSource::class); $truth->setCompanyUser($company_user); $truth->setUser($company_user->user); $truth->setCompany($company_user->company); $truth->setCompanyToken($company_user->tokens()->where('user_id', $company_user->user_id)->where('company_id', $company_user->company_id)->first()); return $this->listResponse($cu); } public function update(UpdateAccountRequest $request, Account $account) { $fi = new \FilesystemIterator(public_path('react'), \FilesystemIterator::SKIP_DOTS); if (iterator_count($fi) < 30) { return response()->json(['message' => 'React App Not Installed, Please install the React app before attempting to switch.'], 400); } $account->fill($request->all()); $account->save(); $this->entity_type = Account::class; $this->entity_transformer = AccountTransformer::class; return $this->itemResponse($account); } }