Files
Atomcms-edit/app/Models/SocialAccount.php
T
2026-05-09 17:32:17 +02:00

31 lines
641 B
PHP
Executable File

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class SocialAccount extends Model
{
protected $table = 'social_accounts';
protected $fillable = [
'user_id',
'provider',
'provider_id',
'avatar',
];
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
public static function findByProvider(string $provider, string $providerId): ?self
{
return static::where('provider', $provider)
->where('provider_id', $providerId)
->first();
}
}