How to use foreach in the controller in Laravel.

DevOps

YOUR COSMETIC CARE STARTS HERE

Find the Best Cosmetic Hospitals

Trusted • Curated • Easy

Looking for the right place for a cosmetic procedure? Explore top cosmetic hospitals in one place and choose with confidence.

“Small steps lead to big changes — today is a perfect day to begin.”

Explore Cosmetic Hospitals Compare hospitals, services & options quickly.

✓ Shortlist providers • ✓ Review options • ✓ Take the next step with confidence

Problem

When I try to loop over a request in the controller, I receive the following error:

Solution

Problem:

I’m having trouble with the Laravel 4 controller’s data looping. This is how my code looks:

the outcome is a returning error. Undefined attribute: Illuminate\Database\Eloquent\Collection::$sku

So, using this code, I try to improvise a little:

Solution

This will throw an error:

Get Data from foreach loop in the controller

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x