Laravel 4 - URI Parameters in Implicit Controllers -
how uri parameters in methods within implicit controller?
first, define base of operations route:
route::controller('users', 'usercontroller');
then,
class usercontroller extends basecontroller { public function getindex() { // } public function postprofile() { // } public function anylogin() { // } }
if want pass aditional parameters in uri, http://myapp/users/{param1}/{param2}
, how can read param1
, param2
within respectve method? in example, getindex()
if want have url http://myapp/users/{param1}/{param2}
need have in controller this:
route::get('users/{param1}/{param2}', 'usercontroller@getindex');
and access it:
class usercontroller extends basecontroller { public function getindex($param1, $param2) { // } }
but hey, can this, routes same:
class usercontroller extends basecontroller { public function getindex() { $param1 = input::get('param1'); $param2 = input::get('param2'); } }
but url like: http://myapp/users?param1=value¶m2=value
laravel laravel-4 parameters controller routes
No comments:
Post a Comment