Domanda

in routes.php:

Route::controller('account', 'AccountController');    

in ajax -> controller:

POST /account/password_reset -> postPasswordReset  //not working
POST /account/passwordReset -> postPasswordReset  //not working
POST /account/password_reset -> postPassword_reset  //not working
POST /account/passwordreset -> postPasswordreset  //working

I was under the impression (and would prefer) the first option, but it's not behaving for me in that way. What should be happening here?

È stato utile?

Soluzione

Laravel 4 uses - to seperate long action names, so in this case your action would look like the following

public function postPasswordReset

and your url's to it would look like

/account/password-reset

However, I recommend using one of the built in router URL helpers, for example HTML::linkAction(), URL::action() or if you're using a form, just specify 'action' => 'YourController@YourAction'

Docs: http://laravel.com/docs/html#opening-a-form

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top