URL Parameter Passing with Laravel
laravel, php
Solution
Route::get('(:any)/(:any)', function($user_name, $user_id) {
echo $user_name;
});
Great to see you using Laravel!
Problem
I want to visit a page like... ``` http://mysitelocaltion/user_name/user_id ``` This is just a virtual link, I have used a .htaccess -rewrite rule to internally pass "user_name" and "use_id" as get parameters for my actual page. How do I achieve the same in Laravel? Update: This shall help (documentation) ``` Route::get('user/(:any)/task/(:num)', function ($username, $task_number) { // $username will be replaced by the value of (:any) // $task_number will be replaced by the integer in place of (:num) $data = array( 'username' => $username, 'task' => $task_number ); return View::make('tasks.for_user', $data); }); ```