M
M
Maxim Volkov2021-01-28 12:37:09
Laravel
Maxim Volkov, 2021-01-28 12:37:09

Why is Laravel model's $casts converter not working?

Why is Laravel model's $casts converter not working?
Product characteristics in the Prodacts table in the properties field are stored in JSON format. To convert data to an array, a property is set in the Product model:

protected $casts = [
        'properties' => 'array',
    ];


For some reason it doesn't work. dd($product->properties) returns data in JSON format, without converting to an array.

I work on the project on two computers with Openserver, home and work. I synchronize the project code through GitHab. Everything works on the home computer, JSON is converted to an array, but on another computer, the same code does not work for some reason.

Does anyone know what might be causing this problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question