1 | <?php |
||
15 | abstract class User extends BaseModel implements AuthenticatableContract, AuthorizableContract, CanResetPasswordContract |
||
16 | { |
||
17 | use Authenticatable, Authorizable, CanResetPassword, HasRoles, SoftDeletes; |
||
18 | |||
19 | /** |
||
20 | * Define the SQL table for this model |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | protected $table = 'users'; |
||
25 | |||
26 | /** |
||
27 | * The attributes excluded from the model's JSON form. |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | protected $hidden = [ |
||
32 | 'password', |
||
33 | 'remember_token', |
||
34 | ]; |
||
35 | |||
36 | protected $fillable = [ |
||
37 | 'username', |
||
38 | 'email', |
||
39 | 'first_name', |
||
40 | 'last_name', |
||
41 | 'display_name', |
||
42 | 'timezone', |
||
43 | 'location', |
||
44 | 'url', |
||
45 | 'social_id', |
||
46 | 'social_avatar', |
||
47 | 'super_flag', |
||
48 | ]; |
||
49 | |||
50 | /** |
||
51 | * Tell eloquent to set deleted_at as a carbon date. |
||
52 | * |
||
53 | * @var array |
||
54 | */ |
||
55 | protected $dates = [ |
||
56 | 'deleted_at', |
||
57 | ]; |
||
58 | |||
59 | /** |
||
60 | * Determines if the users has global rights. |
||
61 | * |
||
62 | * @return mixed |
||
63 | */ |
||
64 | public function isSuperUser() |
||
74 | |||
75 | /** |
||
76 | * Order by name ascending scope |
||
77 | * |
||
78 | * @param Builder $query The current query to append to |
||
79 | * |
||
80 | * @return Builder |
||
81 | */ |
||
82 | public function scopeOrderByNameAsc($query) |
||
86 | |||
87 | /** |
||
88 | * Make sure to hash the user's password on save |
||
89 | * |
||
90 | * @param string $value The value of the attribute (Auto Set) |
||
91 | */ |
||
92 | public function setPasswordAttribute($value) |
||
96 | } |
||
97 |