$value]); if ($value === 0) { return new Account; } /** @var AccountCrudInterface $repository */ $repository = app(AccountCrudInterface::class, [$this->user]); if (isset($this->mapping[$value])) { Log::debug('Found account in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]); $account = $repository->find(intval($this->mapping[$value])); if (!is_null($account->id)) { Log::debug('Found account by ID', ['id' => $account->id]); return $account; } } // not mapped? Still try to find it first: $account = $repository->find($value); if (!is_null($account->id)) { Log::debug('Found account by ID ', ['id' => $account->id]); return $account; } // should not really happen. If the ID does not match FF, what is FF supposed to do? return new Account; } }