1

In my code I have a nested foreach, but when run it shows this error Screenshot of error message

Here is my code:

@foreach ($product as $user)

<p>This is title {{ $user->title }}</p>
<p>This is category {{ $user->category }}</p>
<p>This is sub category {{ $user->sub_category }}</p>

@foreach ($product_image as $product_image)
<p>This is image {{ $product_image->p_image }}</p>
@endforeach

@endforeach

1 Answer 1

1

The second foreach sould be:

@foreach ($User->product_images as $product_image)

an not:

@foreach ($product_image as $product_image)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.