File tree Expand file tree Collapse file tree 2 files changed +43
-9
lines changed Expand file tree Collapse file tree 2 files changed +43
-9
lines changed Original file line number Diff line number Diff line change 33namespace Tests \Fixtures ;
44
55use Illuminate \Database \Eloquent \Model ;
6+ use Illuminate \Database \Eloquent \Relations \BelongsTo ;
67use Oneofftech \Identities \Facades \Identity as IdentityFacade ;
78
89class 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 }
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments