Support the ongoing development of Laravel.io →
Requests Input Forms
Last updated 2 years ago.
0

What's your route look like that's calling getAdd()?

For post information to be passed through to a url via POST you need:

Route::post('<target url>', array(
      'uses' => 'MyController@someDataHandler',
      'as' => 'myKey'
));

Alternatively, if you'd like the incoming data to be arbitrary:

Route::any('<target url>', array(
      'uses' => 'MyController@someDataHandler',
      'as' => 'myKey'
));
Last updated 2 years ago.
0

I dont have a route for get add. Since it was in the products controller I assumed

Route::controller('admin/products', 'ProductsController');

would handle everything on that page. The tutorials dont go much into detail about routes.

So in your example what would 'myKey'?

I have tried:

Route::post('admin/products', array(
    'uses' => 'ProductsController@getAdd',
    'as' => 'Add'
));

and still getting the same result.

Last updated 2 years ago.
0
'as' => 'myKey'

is an easy way to define your routes with a constant name. So, in the event that your route path might change, you don't have to change the call to the route elsewhere, provided you used this constant value 'myKey'.

It is arbitrary, so you can use 'Add' or 'get.add' or even 'irrelevant.name', just try to make it relevant obviously.

Looking at the Route you tried, I can say that the route needs to be synonymous with the route your form is posting to.

Can you post your relevant route file data and the contents of the page you're posting to as well?

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

blufox blufox Joined 29 Jul 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.