all(), $request->getClientIp()))->handle(); if (! ($account instanceof Account)) { return $account; } MultiDB::findAndSetDbByAccountKey($account->key); $cu = CompanyUser::query()->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); } }