1 | <?php |
||
32 | class Socialite extends Model |
||
33 | { |
||
34 | /** |
||
35 | * {@inheritdoc} |
||
36 | */ |
||
37 | protected $fillable = [ |
||
38 | 'user_id', |
||
39 | 'user_type', |
||
40 | 'provider', |
||
41 | 'provider_uid', |
||
42 | ]; |
||
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | protected $casts = [ |
||
48 | 'user_id' => 'integer', |
||
49 | 'user_type' => 'string', |
||
50 | 'provider' => 'string', |
||
51 | 'provider_uid' => 'string', |
||
52 | ]; |
||
53 | |||
54 | /** |
||
55 | * Create a new Eloquent model instance. |
||
56 | * |
||
57 | * @param array $attributes |
||
58 | */ |
||
59 | public function __construct(array $attributes = []) |
||
65 | |||
66 | /** |
||
67 | * Get the owning user. |
||
68 | * |
||
69 | * @return \Illuminate\Database\Eloquent\Relations\MorphTo |
||
70 | */ |
||
71 | public function user(): MorphTo |
||
75 | |||
76 | /** |
||
77 | * Get socialites of the given user. |
||
78 | * |
||
79 | * @param \Illuminate\Database\Eloquent\Builder $builder |
||
80 | * @param \Illuminate\Database\Eloquent\Model $user |
||
81 | * |
||
82 | * @return \Illuminate\Database\Eloquent\Builder |
||
83 | */ |
||
84 | public function scopeOfUser(Builder $builder, Model $user): Builder |
||
88 | } |
||
89 |