vendredi 8 novembre 2019

Eloquent mutators cast object always return null value

I have issue. In my model $casts I set 'data' => 'object', when I retrive property laravel always return null value.

$casts:

    // Model casts
    protected $casts = [
        'status' => 'boolean',
        'sticky' => 'boolean',
        'data' => 'object',
    ];


    >>> \App\Account::first()->data;
    => "{"so_tuong":"123","so_skin":"123","ngoc":"123","rank":"4"}"

When I retrive some property:

>>> \App\Account::first()->ngoc;
=> null


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire