How to implement array type route in Laravel?

Asked
Active3 hr before
Viewed126 times

2 Answers

implementarray
90%

How can I overcome the setbacks of a negligent supervisor after earning a PhD degree? , Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers ,I am trying to implement an array type route in Laravel 5.8. Here's what I tried: ,By above route you can create following urls for the same controller function

Here is the example which you want to implement.

Route::get('/{param?}', 'MyController@index') -
   > where('param', '(myroute|myroute2)');

By above route you can create following urls for the same controller function

www.site.com /
   www.site.com / myroute
www.site.com / myroute2
load more v
88%

You may define as many route parameters as required by your route:, Routing ,Or, you may instruct an entire group of route definitions to use scoped bindings:,Attaching Rate Limiters To Routes

The most basic Laravel routes accept a URI and a closure, providing a very simple and expressive method of defining routes and behavior without complicated routing configuration files:

use Illuminate\ Support\ Facades\ Route;

Route::get('/greeting', function() {
   return 'Hello World';
});
load more v

Other "implement-array" queries related to "How to implement array type route in Laravel?"