Skip to content

Commit b4d56d3

Browse files
committed
Update fixtures to use new conventions
1 parent 6ecd106 commit b4d56d3

File tree

2 files changed

+43
-9
lines changed

2 files changed

+43
-9
lines changed

tests/Fixtures/Identity.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,11 @@
33
namespace Tests\Fixtures;
44

55
use Illuminate\Database\Eloquent\Model;
6+
use Illuminate\Database\Eloquent\Relations\BelongsTo;
67
use Oneofftech\Identities\Facades\Identity as IdentityFacade;
78

89
class Identity extends Model
910
{
10-
/**
11-
* @var array
12-
*/
13-
protected $casts = [
14-
'expires_at' => 'datetime',
15-
'registration' => 'bool',
16-
];
17-
1811
/**
1912
* @var array
2013
*/
@@ -38,7 +31,20 @@ class Identity extends Model
3831
'expires_at',
3932
];
4033

41-
public function user()
34+
/**
35+
* Get the attributes that should be cast.
36+
*
37+
* @return array<string, string>
38+
*/
39+
protected function casts(): array
40+
{
41+
return [
42+
'expires_at' => 'datetime',
43+
'registration' => 'bool',
44+
];
45+
}
46+
47+
public function user(): BelongsTo
4248
{
4349
return $this->belongsTo(IdentityFacade::userModel());
4450
}

tests/Fixtures/User.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,37 @@ class User extends Authenticatable
99
{
1010
use WithIdentities;
1111

12+
/**
13+
* The attributes that are mass assignable.
14+
*
15+
* @var list<string>
16+
*/
1217
protected $fillable = [
1318
'name',
1419
'email',
1520
'password',
1621
];
22+
23+
/**
24+
* The attributes that should be hidden for serialization.
25+
*
26+
* @var list<string>
27+
*/
28+
protected $hidden = [
29+
'password',
30+
'remember_token',
31+
];
32+
33+
/**
34+
* Get the attributes that should be cast.
35+
*
36+
* @return array<string, string>
37+
*/
38+
protected function casts(): array
39+
{
40+
return [
41+
'email_verified_at' => 'datetime',
42+
'password' => 'hashed',
43+
];
44+
}
1745
}

0 commit comments

Comments
 (0)