Sunday, 15 April 2012

php - Laravel route thinks function is something else -



php - Laravel route thinks function is something else -

what have website sign , sends link token email address take password; when go link given this;

branch/pass/token_here

so route have helps this;

routes.php

route::get('pass/{token}', 'passcontroller@gettoken');

and have in;

passcontroller.php in gettoken function

public function gettoken($token) { //i stuff token here }

i have function in passcontroller.php file

public function getpassword() { //when user enters password in box provided should come function , stuff }

but when navigate

branch/pass/password

it sees word 'password' token itself, there anyway around this? in advance!

to page calls getpassword() need add together new route it:

routes.php

route::get('pass/password', 'passcontroller@getpassword'); route::get('pass/{token}', 'passcontroller@gettoken');

and phone call via url branch/pass/password.

however, recommend maintain 2 routes not sharing pass segment, sake of not confusing whether it's request stuff token, or password. example:

route::get('password', 'passcontroller@getpassword'); route::get('token/{token}', 'passcontroller@gettoken');

php laravel laravel-routing

No comments:

Post a Comment