mardi 11 février 2020

how to access data in query after casting it to array in model

I am using laravel v5.2 when I tried to make my table coloumns data type Json that cause error because of mysql version. I read solution about this I can make its type text and casting them in my model to array like that

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

in my controller this my query

$devision= admin_panel::find(1);

when dd($devision->division1); the result is null but when I removed the casting it return the result with no proplem I tried this $devision= admin_panel::find(1)->toarray(); but also dd($devision['division1']); returns null



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2HelsgL
via IFTTT

Aucun commentaire:

Enregistrer un commentaire