|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace TestSetup\Models; |
|
4
|
|
|
|
|
5
|
|
|
use LaravelFreelancerNL\Aranguent\Eloquent\Casts\AsArrayObject; |
|
6
|
|
|
use LaravelFreelancerNL\Aranguent\Eloquent\Casts\AsCollection; |
|
7
|
|
|
use LaravelFreelancerNL\Aranguent\Eloquent\Casts\AsEnumArrayObject; |
|
8
|
|
|
use LaravelFreelancerNL\Aranguent\Eloquent\Casts\AsEnumCollection; |
|
9
|
|
|
use TestSetup\Enums\UserStatus; |
|
10
|
|
|
|
|
11
|
|
|
class User extends \LaravelFreelancerNL\Aranguent\Auth\User |
|
12
|
|
|
{ |
|
13
|
|
|
protected $table = 'users'; |
|
14
|
|
|
|
|
15
|
|
|
protected $fillable = [ |
|
16
|
|
|
'email', |
|
17
|
|
|
'password', |
|
18
|
|
|
'uuid', |
|
19
|
|
|
'is_admin', |
|
20
|
|
|
'profileAsArray', |
|
21
|
|
|
'profileAsArrayObjectCast', |
|
22
|
|
|
'profileAsObject', |
|
23
|
|
|
'profileAsJson', |
|
24
|
|
|
'favoritesCollection', |
|
25
|
|
|
'favoritesAsCollectionCast', |
|
26
|
|
|
'statusesAsEnumArrayObject', |
|
27
|
|
|
'statusesAsEnumCollection', |
|
28
|
|
|
]; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* Get the attributes that should be cast. |
|
32
|
|
|
* |
|
33
|
|
|
* @return array<string, string> |
|
34
|
|
|
*/ |
|
35
|
|
|
protected function casts(): array |
|
36
|
|
|
{ |
|
37
|
|
|
return [ |
|
38
|
|
|
'is_admin' => 'boolean', |
|
39
|
|
|
'profileAsArray' => 'array', |
|
40
|
|
|
'profileAsArrayObjectCast' => AsArrayObject::class, |
|
41
|
|
|
'profileAsObject' => 'object', |
|
42
|
|
|
'profileAsJson' => 'json', |
|
43
|
|
|
'favoritesCollection' => 'collection', |
|
44
|
|
|
'favoritesAsCollectionCast' => AsCollection::class, |
|
45
|
|
|
'statusesAsEnumArrayObject' => AsEnumArrayObject::of(UserStatus::class), |
|
46
|
|
|
'statusesAsEnumCollection' => AsEnumCollection::of(UserStatus::class), |
|
47
|
|
|
]; |
|
48
|
|
|
} |
|
49
|
|
|
} |
|
50
|
|
|
|