SocialProvider::class, ]; } /** * @return BelongsTo */ public function user(): BelongsTo { return $this->belongsTo(User::class); } /** * The account this identity signs in as, or null. * * The subject, never the email. A provider that lets somebody change * their address — most of them — must not thereby change which * account they land on. */ public static function resolve(SocialIdentity $identity): ?User { return static::query() ->where('provider', $identity->provider->value) ->where('provider_user_id', $identity->subject) ->first()?->user; } }