- Laravel Version: 8.56.0
- PHP Version: 8.*
- Database Driver & Version: PostgresSQL
Description:
If we want to create a nested array with AsArrayObject, AsCollection on the nullable column, if the column is null we will get the error
Steps To Reproduce:
I did what taylor does in laracon:
protected $casts = [
'permisions' => AsArrayObject::class
];
$user = User::first();
//$user->settings is null here
$user->settings['role']['name'] = 'Developer';
$user->save();
ErrorException : Undefined array key "role"
The problem is the permisions is null , it should be empty array and taylor didnt mention that on the video:
