Skip to content
Advertisement

Laravel: Undefined variable in @foreach

I want to display order_details table on web, but @foreach loop says Undefined variable $order_details Here is my @foreach loop

JavaScript

My order controller contains this:

JavaScript

index.blade.php contains only css and javascript code. my index.blade.php is further connected to livewire(order.blade.php) like this

@livewire(‘order’)

my livewire(order.blade.php) contains this code

JavaScript

Advertisement

Answer

What I noticed in your code is that you might be expecting an answer in another place while your code is running somewhere else. First of all, you are writing a show(Order $order) function that collects parameters, while you are outputting it in the index page, so where you are calling the show function will expect a parameter, while the index will not expect a parameter

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement