|
1
|
|
|
<?php namespace App\Models; |
|
2
|
|
|
|
|
3
|
|
|
use Illuminate\Database\Eloquent\Builder; |
|
4
|
|
|
use Illuminate\Database\Eloquent\Model; |
|
5
|
|
|
|
|
6
|
|
|
/** |
|
7
|
|
|
* App\Models\UserOAuth |
|
8
|
|
|
* |
|
9
|
|
|
* @mixin \Eloquent |
|
10
|
|
|
* @property integer $id |
|
11
|
|
|
* @property integer $user_id |
|
12
|
|
|
* @property string $remote_provider |
|
13
|
|
|
* @property string $remote_id |
|
14
|
|
|
* @property string $nickname |
|
15
|
|
|
* @property string $name |
|
16
|
|
|
* @property string $email |
|
17
|
|
|
* @property string $avatar |
|
18
|
|
|
* @property \Carbon\Carbon $created_at |
|
19
|
|
|
* @property \Carbon\Carbon $updated_at |
|
20
|
|
|
* @property-read \App\Models\User $owner |
|
21
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\UserOAuth whereId($value) |
|
22
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\UserOAuth whereUserId($value) |
|
23
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\UserOAuth whereRemoteProvider($value) |
|
24
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\UserOAuth whereRemoteId($value) |
|
25
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\UserOAuth whereNickname($value) |
|
26
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\UserOAuth whereName($value) |
|
27
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\UserOAuth whereEmail($value) |
|
28
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\UserOAuth whereAvatar($value) |
|
29
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\UserOAuth whereCreatedAt($value) |
|
30
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\UserOAuth whereUpdatedAt($value) |
|
31
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\UserOAuth ofProvider($provider) |
|
32
|
|
|
*/ |
|
33
|
|
|
class UserOAuth extends Model |
|
34
|
|
|
{ |
|
35
|
|
|
protected $table = 'users_oauth'; |
|
36
|
|
|
|
|
37
|
|
|
protected $hidden = []; |
|
38
|
|
|
|
|
39
|
|
|
protected $fillable = ['*']; |
|
40
|
|
|
|
|
41
|
|
|
public function owner() |
|
42
|
|
|
{ |
|
43
|
|
|
return $this->belongsTo(User::class, 'user_id', 'id'); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @param Builder $query |
|
48
|
|
|
* @param string $provider |
|
49
|
|
|
* |
|
50
|
|
|
* @return mixed |
|
51
|
|
|
*/ |
|
52
|
|
|
public function scopeOfProvider(Builder $query, $provider) |
|
53
|
|
|
{ |
|
54
|
|
|
return $query->where('remote_provider', '=', $provider); |
|
55
|
|
|
} |
|
56
|
|
|
} |
|
57
|
|
|
|