Skip to content

Commit e644e27

Browse files
committed
Add type cast
1 parent e217f9a commit e644e27

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Traits/HasActive.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@
66

77
trait HasActive
88
{
9+
public function bootHasActive(): void
10+
{
11+
// append the is_active column to the fillable array
12+
$this->fillable[] = 'is_active';
13+
14+
// add the is_active column to the casts array
15+
$this->casts['is_active'] = 'boolean';
16+
}
17+
918
public function scopeStatus(mixed $query, bool $status): Builder
1019
{
1120
return $query->where('is_active', $status);

0 commit comments

Comments
 (0)