mardi 5 avril 2016

Laravel query builder using hasMany output

This is my syntax in blade file :

{{ $product->filters->where("filter_id","10") }}

And my output for this : {"3":{"id":7153,"product_id":"1","filter_id":"10","data":"Kajaria","created_at":null,"updated_at":null}}

And I want to extract only a particular data i.e. "Kajaria". I'm getting confused in writing syntax. I had already tried these syntaxes :

{{ $product->filters->where("filter_id","10")->data }}
{{ $product->filters->where("filter_id","10")['data'] }}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire