1
|
|
|
<?php namespace App\Models; |
2
|
|
|
|
3
|
|
|
use App\Traits\Users\CanActivate; |
4
|
|
|
use Illuminate\Auth\Passwords\CanResetPassword; |
5
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes; |
6
|
|
|
use Illuminate\Foundation\Auth\User as Authenticatable; |
7
|
|
|
use Illuminate\Notifications\Notifiable; |
8
|
|
|
use Laravel\Passport\HasApiTokens; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* App\Models\User |
12
|
|
|
* |
13
|
|
|
* @mixin \Eloquent |
14
|
|
|
* @property integer $id |
15
|
|
|
* @property string $name |
16
|
|
|
* @property string $email |
17
|
|
|
* @property string $password |
18
|
|
|
* @property \Carbon\Carbon $created_at |
19
|
|
|
* @property \Carbon\Carbon $updated_at |
20
|
|
|
* @property \Carbon\Carbon $deleted_at |
21
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|UserOAuth[] $linkedAccounts |
22
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|File[] $files |
23
|
|
|
* @method static \Illuminate\Database\Query\Builder|User whereId($value) |
24
|
|
|
* @method static \Illuminate\Database\Query\Builder|User whereName($value) |
25
|
|
|
* @method static \Illuminate\Database\Query\Builder|User whereEmail($value) |
26
|
|
|
* @method static \Illuminate\Database\Query\Builder|User wherePassword($value) |
27
|
|
|
* @method static \Illuminate\Database\Query\Builder|User whereCreatedAt($value) |
28
|
|
|
* @method static \Illuminate\Database\Query\Builder|User whereUpdatedAt($value) |
29
|
|
|
* @method static \Illuminate\Database\Query\Builder|User whereDeletedAt($value) |
30
|
|
|
*/ |
31
|
|
|
class User extends Authenticatable |
32
|
|
|
{ |
33
|
|
|
use Notifiable, HasApiTokens, CanActivate, CanResetPassword, SoftDeletes; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* The attributes excluded from the model's JSON form. |
37
|
|
|
* |
38
|
|
|
* @var array |
39
|
|
|
*/ |
40
|
|
|
protected $hidden = ['password', 'remember_token']; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* The attributes that are mass assignable. |
44
|
|
|
* |
45
|
|
|
* @var array |
46
|
|
|
*/ |
47
|
|
|
protected $fillable = ['name', 'email', 'password']; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Soft-deletes enabled. |
51
|
|
|
* |
52
|
|
|
* @var array |
53
|
|
|
*/ |
54
|
|
|
protected $dates = ['deleted_at']; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany |
58
|
|
|
*/ |
59
|
|
|
public function linkedAccounts() |
60
|
|
|
{ |
61
|
|
|
return $this->hasMany(UserOAuth::class, 'user_id', 'id'); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
66
|
|
|
*/ |
67
|
|
|
public function files() |
68
|
|
|
{ |
69
|
|
|
return $this->belongsToMany(File::class, 'files_users', 'user_id', 'file_hash')->withTimestamps()->withPivot(['uuid', 'original_client_name']); |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|