Skip to content
Advertisement

Passing multiple parameters to controller in Laravel 5

In my application, a user has the ability to remind another user about an event invitation. To do that, I need to pass both the IDs of the event, and of the user to be invited.

In my route file, I have:

JavaScript

In my view, I have:

JavaScript

In my controller, I have:

JavaScript

However, when I hit that route, I receive the following error:

JavaScript

I’m sure I have a formatting error in my view, but I’ve been unable to diagnose it. Is there a more efficient way to pass multiple arguments to a controller?

Advertisement

Answer

When you define this route:

JavaScript

You are saying that a single URI argument will be passed to the method.

Try passing the two arguments, like:

JavaScript

View:

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