|
1
|
|
|
<?php namespace App\Models; |
|
2
|
|
|
|
|
3
|
|
|
use Cartalyst\Sentinel\Users\EloquentUser; |
|
4
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes; |
|
5
|
|
|
|
|
6
|
|
|
/** |
|
7
|
|
|
* App\Models\User |
|
8
|
|
|
* |
|
9
|
|
|
* @mixin \Eloquent |
|
10
|
|
|
* @property integer $id |
|
11
|
|
|
* @property string $name |
|
12
|
|
|
* @property string $email |
|
13
|
|
|
* @property string $password |
|
14
|
|
|
* @property string $permissions |
|
15
|
|
|
* @property string $last_login |
|
16
|
|
|
* @property \Carbon\Carbon $created_at |
|
17
|
|
|
* @property \Carbon\Carbon $updated_at |
|
18
|
|
|
* @property \Carbon\Carbon $deleted_at |
|
19
|
|
|
* @property-read \App\Models\UserOAuth[] $linkedAccounts |
|
20
|
|
|
* @property-read \Cartalyst\Sentinel\Roles\EloquentRole[] $roles |
|
21
|
|
|
* @property-read \Cartalyst\Sentinel\Persistences\EloquentPersistence[] $persistences |
|
22
|
|
|
* @property-read \Cartalyst\Sentinel\Activations\EloquentActivation[] $activations |
|
23
|
|
|
* @property-read \Cartalyst\Sentinel\Reminders\EloquentReminder[] $reminders |
|
24
|
|
|
* @property-read \Cartalyst\Sentinel\Throttling\EloquentThrottle[] $throttle |
|
25
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereId($value) |
|
26
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereName($value) |
|
27
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereEmail($value) |
|
28
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\User wherePassword($value) |
|
29
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereCreatedAt($value) |
|
30
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereUpdatedAt($value) |
|
31
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereDeletedAt($value) |
|
32
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\User wherePermissions($value) |
|
33
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereLastLogin($value) |
|
34
|
|
|
*/ |
|
35
|
|
|
class User extends EloquentUser |
|
36
|
|
|
{ |
|
37
|
|
|
use SoftDeletes; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* The attributes excluded from the model's JSON form. |
|
41
|
|
|
* |
|
42
|
|
|
* @var array |
|
43
|
|
|
*/ |
|
44
|
|
|
protected $hidden = ['password']; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* {@inheritDoc} |
|
48
|
|
|
*/ |
|
49
|
|
|
protected $fillable = [ |
|
50
|
|
|
'email', |
|
51
|
|
|
'password', |
|
52
|
|
|
'name', |
|
53
|
|
|
'permissions', |
|
54
|
|
|
]; |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* Soft-deletes enabled. |
|
58
|
|
|
* |
|
59
|
|
|
* @var array |
|
60
|
|
|
*/ |
|
61
|
|
|
protected $dates = ['deleted_at']; |
|
62
|
|
|
|
|
63
|
|
|
public function linkedAccounts() |
|
64
|
|
|
{ |
|
65
|
|
|
return $this->hasMany(UserOAuth::class, 'user_id', 'id'); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function files() |
|
69
|
|
|
{ |
|
70
|
|
|
return $this->belongsToMany(File::class, 'files_users', 'user_id', 'file_hash')->withTimestamps()->withPivot(['uuid', 'original_client_name', 'original_client_extension']); |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|