jeudi 10 décembre 2020

laravel how to parse compact variable

@foreach($brand as $br)

@endforeach

i echo out my variable like this and i get this output

[{"id":1,"title":"Eurboor","description":null,"status":1,"slug":"eurboor","icon":null,"sort":0,"pivot":{"product_category_id":4,"brand_id":1}}] [] [{"id":2,"title":"Aquasol","description":null,"status":1,"slug":"aquasol","icon":null,"sort":0,"pivot":{"product_category_id":6,"brand_id":2}}] [{"id":1,"title":"Eurboor","description":null,"status":1,"slug":"eurboor","icon":null,"sort":0,"pivot":{"product_category_id":7,"brand_id":1}}] [{"id":1,"title":"Eurboor","description":null,"status":1,"slug":"eurboor","icon":null,"sort":0,"pivot":{"product_category_id":8,"brand_id":1}}] [{"id":5,"title":"D.W.T","description":null,"status":1,"slug":"dwt","icon":null,"sort":0,"pivot":{"product_category_id":9,"brand_id":5}}] [{"id":3,"title":"Steel Weld","description":null,"status":1,"slug":"steel-weld","icon":null,"sort":0,"pivot":{"product_category_id":10,"brand_id":3}}]

So how do i get "brand_id" or something else i tried $br->brands->brand_id or similar thing but it didnt work pls help me out :(



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire