Looks good to me.
Only this:
$item->mybrands = Outfit::find($id)->brands->lists('name');
$item->mystyles = Outfit::find($id)->styles->lists('name');
$item->mystores = Outfit::find($id)->stores->lists('name');
You should store Outfit::find($id) in a variable. If you want, you can also use "with".
Greetings.
Thank you @Ruk33 for your answer. I thought Laravel itself had some special method to deal with this. I'm happy I found the right solution from the start.
Great question, elaborated very well! I also find myself often in the situation where I'm not sure how to pass data to the view. Further opinions are appreciated!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community