user7424490
user7424490

Reputation:

Laravel 8: Weird missing required parameter

I have a form action like this:

action="{{ route('verify.order', $order->id) }}"

And on web.php:

Route::post(
            'order/verify/{id}' , 
            [App\Http\Controllers\Admin\OrderController::class, 'verify']
           )->name('verify.order');

Also I call the method on Controller like this:

public function verify(Request $request, $id)

But as soon as I try to load the Blade, I get this error:

Missing required parameter for [Route: verify.order]` [Missing parameter: id]. (View: order.blade.php)

So what is going wrong here? How can I fix this issue?

Upvotes: 3

Views: 841

Answers (1)

shaedrich
shaedrich

Reputation: 5715

You might pass the route parameter(s) as array:

action="{{ route('verify.order', ['id' => $order->id ]) }}"

Upvotes: 1

Related Questions