For example, Controller has a function
<code>public function test($var) { //some code... }</code>
How to call Controller's test('abc')
when defining get/abc
in routes.php?
There is no need for generic variables such as Route::get(/{var}', function($var)...
This is because the value of $var is fixed.
For example, Controller has a function
<code>public function test($var) { //some code... }</code>
How to call Controller's test('abc')
when defining get/abc
in routes.php?
There is no need for generic variables such as Route::get(/{var}', function($var)...
This is because the value of $var is fixed.
<code>Route::get('/{var}',function($var){ return $var; })->where('var','a|b|c|d|e|f|g');</code>
Request
objects can also be obtained.
<code>// URL: /portal/orders/2 public function _test(Request $request) { // 1: portal // 2: orders // 3: 2 return Request::segment(1); }</code>