Skip to content

Commit be08ed1

Browse files
committed
Switch to casts() method
1 parent 47000f0 commit be08ed1

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

stubs/Identities/Models/Identity.stub

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,11 @@
33
namespace App;
44

55
use Illuminate\Database\Eloquent\Model;
6-
6+
use Illuminate\Database\Eloquent\Relations\BelongsTo;
77
use Oneofftech\Identities\Facades\Identity as IdentityFacade;
88

99
class Identity extends Model
1010
{
11-
12-
/**
13-
* @var array
14-
*/
15-
protected $casts = [
16-
'expires_at' => 'datetime',
17-
'registration' => 'bool',
18-
];
19-
2011
/**
2112
* @var array
2213
*/
@@ -39,11 +30,24 @@ class Identity extends Model
3930
'refresh_token',
4031
'expires_at',
4132
];
42-
33+
4334
/**
35+
* Get the attributes that should be cast.
4436
*
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+
/**
48+
* The user to whom this identity belongs.
4549
*/
46-
public function user()
50+
public function user(): BelongsTo
4751
{
4852
return $this->belongsTo(IdentityFacade::userModel());
4953
}

0 commit comments

Comments
 (0)