In the blade template:
<?php
$meta = json_encode($datas,true);
echo $meta;
?>
It shows:
{"data":[{"id":1,"title":"Alice.","rating":0},
{"id":2,"title":"So Alice.","rating":2},
{"id":3,"title":"Alice.","rating":2},
{"id":4,"title":"After a.","rating":2},
{"id":5,"title":"Alice.","rating":0}],
"meta":{"song_count":5}}
My question is how to get (song_count: 5 ) in blade template. I have tried : echo $meta['meta'];
" it shows;
"Illegal string offset 'meta'"
Anyone can help, thank you so much
$data? You can get it from the data arrayvar_dump(data);to see is that the array or the object. Then access those elements/members accordingly.