You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
The text was updated successfully, but these errors were encountered:
As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.
If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.
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 caseboolean
) 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
The text was updated successfully, but these errors were encountered: