Skip to content

Commit 3f26312

Browse files
author
Curtis Delicata
committed
Fixes
1 parent 77da920 commit 3f26312

File tree

14 files changed

+104
-48
lines changed

14 files changed

+104
-48
lines changed

app/Exceptions/Handler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,4 @@ public function register(): void
4848
});
4949
}
5050
}
51+
}

app/Models/Author.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ class Author extends Model
1616

1717
protected $attributes = ['is_active' => false];
1818

19-
protected $casts = ['is_active' => 'boolean'];
20-
2119
public function user(): BelongsTo
2220
{
2321
return $this->belongsTo(User::class, 'user_id', 'id');
2422
}
23+
protected function casts(): array
24+
{
25+
return ['is_active' => 'boolean'];
26+
}
2527
}

app/Models/Citation.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ class Citation extends Model
1616

1717
protected $attributes = ['is_active' => false];
1818

19-
protected $casts = ['is_active' => 'boolean'];
20-
2119
public function sources()
2220
{
2321
return $this->belongsToMany(Source::class);
@@ -27,4 +25,8 @@ public function user(): BelongsTo
2725
{
2826
return $this->belongsTo(User::class, 'user_id', 'id');
2927
}
28+
protected function casts(): array
29+
{
30+
return ['is_active' => 'boolean'];
31+
}
3032
}

app/Models/ConnectedAccount.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,6 @@ class ConnectedAccount extends SocialstreamConnectedAccount
3232
'expires_at',
3333
];
3434

35-
/**
36-
* The attributes that should be cast.
37-
*
38-
* @var array
39-
*/
40-
protected $casts = [
41-
'created_at' => 'datetime',
42-
'expires_at' => 'datetime',
43-
];
44-
4535
/**
4636
* The event map for the model.
4737
*
@@ -52,4 +42,16 @@ class ConnectedAccount extends SocialstreamConnectedAccount
5242
'updated' => ConnectedAccountUpdated::class,
5343
'deleted' => ConnectedAccountDeleted::class,
5444
];
45+
/**
46+
* The attributes that should be cast.
47+
*
48+
* @return array
49+
*/
50+
protected function casts(): array
51+
{
52+
return [
53+
'created_at' => 'datetime',
54+
'expires_at' => 'datetime',
55+
];
56+
}
5557
}

app/Models/Gedcom.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ class Gedcom extends Model
2222
'db_name',
2323
];
2424

25-
protected $casts = [
26-
'data' => 'array',
27-
];
25+
protected function casts(): array
26+
{
27+
return [
28+
'data' => 'array',
29+
];
30+
}
2831
}

app/Models/Geneanum.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ class Geneanum extends Model
2222
'db_name',
2323
];
2424

25-
protected $casts = [
26-
'data' => 'array',
27-
];
25+
protected function casts(): array
26+
{
27+
return [
28+
'data' => 'array',
29+
];
30+
}
2831
}

app/Models/Person.php

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,6 @@ class Person extends Model
4141
'tree_position_x',
4242
'tree_position_y',
4343
];
44-
// public function searchableAs()
45-
// {
46-
// return 'name';
47-
// }
48-
49-
/**
50-
* The attributes that should be mutated to dates.
51-
*
52-
* @var array
53-
*/
54-
protected $casts = [
55-
'deleted_at' => 'datetime',
56-
'birthday' => 'datetime',
57-
'deathday' => 'datetime',
58-
'burial_day' => 'datetime',
59-
'chan' => 'datetime',
60-
];
6144

6245
protected $guarded = ['id'];
6346

@@ -175,12 +158,12 @@ public function addEvent($title, $date, $place, $description = '')
175158

176159
public function birth()
177160
{
178-
return $this->events->where('title', '=', 'BIRT')->first();
161+
return $this->dispatchesEvents->where('title', '=', 'BIRT')->first();
179162
}
180163

181164
public function death()
182165
{
183-
return $this->events->where('title', '=', 'DEAT')->first();
166+
return $this->dispatchesEvents->where('title', '=', 'DEAT')->first();
184167
}
185168

186169
public function scopeWithBasicInfo($query)
@@ -202,4 +185,19 @@ public static function getBasicInfoCached($id)
202185
{
203186
return cache()->remember("person_basic_info_{$id}", now()->addHours(1), fn() => self::withBasicInfo()->find($id));
204187
}
188+
/**
189+
* The attributes that should be mutated to dates.
190+
*
191+
* @return array
192+
*/
193+
protected function casts(): array
194+
{
195+
return [
196+
'deleted_at' => 'datetime',
197+
'birthday' => 'datetime',
198+
'deathday' => 'datetime',
199+
'burial_day' => 'datetime',
200+
'chan' => 'datetime',
201+
];
202+
}
205203
}

app/Models/Repository.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ class Repository extends Model
2222

2323
protected $attributes = ['is_active' => false];
2424

25-
protected $casts = ['is_active' => 'boolean'];
26-
2725
public function sources()
2826
{
2927
return $this->hasMany(Source::class);
3028
}
29+
protected function casts(): array
30+
{
31+
return ['is_active' => 'boolean'];
32+
}
3133
}

app/Models/Type.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,8 @@ class Type extends Model
1515

1616
protected $attributes = ['is_active' => false];
1717

18-
protected $casts = ['is_active' => 'boolean'];
18+
protected function casts(): array
19+
{
20+
return ['is_active' => 'boolean'];
21+
}
1922
}

app/Providers/TeamServiceProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ public function boot(): void
3636
{
3737
}
3838
}
39+
}

0 commit comments

Comments
 (0)