Closed
Description
Laravel Version
10.37.4
PHP Version
8.2
Database Driver & Version
No response
Description
When having Model::preventAccessingMissingAttributes()
active in theAppServiceProvider.php
and there's a model with a cast (in our case boolean
) it will not throw an exception when accessing the attribute if it isn't loaded.
When removing the cast it does throw an exception.
Steps To Reproduce
class Test extends Model
{
protected $fillable = [
'some_boolean',
];
protected $casts = [
'some_boolean' => 'boolean',
];
}
Test::create(['some_boolean' => true]);
$test = Test::select('id')->first();
$test->some_boolean; (null)