/** * Get ID of an existing user or create them first. * * @param array $profile * @return int */ protected function obtainUserId(array $profile) { $user = $this->user->where('email', '=', $profile['email'])->first(); return $user ? $user->getKey() : $this->createUser($profile)->getKey(); }