/** * Find the specified resource in the database. * * @param string $id Northstar ID * @return object */ public function find($id) { $user = User::findOrFail($id); $account = $this->northstar->getUser('_id', $user->id); if ($account) { $account->role = $user->role; return $account; } return $user; }
/** * Resolve user account within Northstar/Gladiator system. * * @param array $credentials * @return \Gladiator\Models\User|object * @throws \Gladiator\Services\Northstar\Exceptions\NorthstarUserNotFoundException */ public function findUserAccount($credentials) { $northstarUser = $this->northstar->getUser($credentials['term'], $credentials['id']); if (!$northstarUser) { throw new NorthstarUserNotFoundException(); } // @TODO: Can't use Repository method below because it throws exception // and here we just need "null" if user not found in Database. Find a // better fix if necessary! $user = User::find($northstarUser->id); if (!$user) { return $northstarUser; } return $user; }