How to use the ROUTE helper?


#1

I have this line of code to process an update


<form action="{{ '/user/' + findUser.id }}" method="POST">

nevertheless I would like to use the route() helper in order to achieve a better and more concise usage about writting routes

I have tried this but it doesnt works


<form action="{{ route('UserController'+ findUser.id) }}" method="POST">


When I try to process an update, I have this error

Route not found /user/modificar/null

What can I do?


#2

Hey Shadow. Do the following.

Go to start/routes.js and define a route, ex:

Route.get('users/:id', 'UserController.methodName').as('users.find')

Now you may use this route in the following way:

{{ route('users.find', { id: findUser.id }) }}


#3

thanks a lot bro well done