Skip to content
Advertisement

Tag: laravel

store data into pivot table laravel 8

i have manytomany relation ship between categroy and product category model product model the pivot table what should i do after this i did not undrestant how attach will work in pivot table and return it with the product as json response ? edit this is the schema i am working on i want to give each product it’s own

Transform nested collection in laravel

I have a nested collection that I want to transform, pulling some keys “up a level” and discarding some other keys. Every item in the collection has an allergens property. I need to make each items allergens property, look like I’ve tried the following: But it doesn’t overwrite the allergens property Answer Since you’re posting your collection as JSON, I

how to use explode for an array of objects

I have an array like that: I want to do a foreach in “prerequis”: I need in second foreach to use in $value2[‘champ’] where $value2[‘champ’] is “tranche.fus.fup_id. So I need to explode that to have [‘tranche’][‘fus’][‘fup_id’]. How to use explode with that ? thanks everyone 🙂 Answer you can use laravel data_get helper:

Advertisement