Laravel provides AsArrayObject and AsCollection casts to handle complex JSON attributes more effectively, enabling
intuitive manipulation of nested data structures.

use Illuminate\Database\Eloquent\Casts\AsArrayObject;
use Illuminate\Database\Eloquent\Casts\AsCollection;

class User extends Model
{
    protected $casts = [
        'settings' => AsArrayObject::class,
        'tags' => AsCollection::class
    ];
}
continue reading on news.extly.com

⚠️ This post links to an external website. ⚠️