I am using Laravel 7.30.6 and have PHP 8.0.10 on my development machine; I am experiecing a weird issue where any model attributes that are booleans in my DB and have been correctly added to my $casts
attribute in the Model still return 1
if the DB value is true
.
I did see this SO post where they mentioned this is a bug, but it appears its been resolved in PHP8.0.6 which I'm already using a version higher than.
Can someone tell me how to resolve this? I have confirmed I am using PHP8.0.10 by typing php -v
into my terminal.
Edit:
I have updated to Laravel v8.80 and this is still encountering the same issues. My PHP version is v8.0.10 which is beyond the v8.0.6 version claimed in the github issue page to have fixed it yet the problem still exists for me.
Second Edit:
Table Defintion using PostgreSQL v12.2
| table_name | column_name | data_type |
|------------|--------------------------|-----------------------------|
| businesses | id | bigint |
| businesses | name | text |
| businesses | business_type_id | bigint |
| businesses | is_active | boolean |
| businesses | created_at | timestamp without time zone |
| businesses | updated_at | timestamp without time zone |
| businesses | enable_multi_queue | boolean |
| businesses | multi_queue_active | boolean |
| businesses | enable_shortest_option | boolean |
| businesses | default_shortest | boolean |
Model defintion:
class Business extends Model
{
protected $casts = [
'is_active' => 'boolean',
'enable_multi_queue' => 'boolean',
'multi_queue_active' => 'boolean',
'enable_shortest_option' => 'boolean',
'default_shortest' => 'boolean',
];
Link to Github Issue: https://github.com/laravel/framework/issues/37215