php - Laravel - can I control routes by rule? -


so have laravel controller (maincontroller.php) following lines:

... public function _settings_a(){     return view('_settings_a'); } public function _settings_b(){     return view('_settings_b'); } public function _settings_c(){     return view('_settings_c'); } public function _settings_d(){     return view('_settings_d'); } public function _staff_a(){     return view('_staff_a'); } public function _staff_b(){     return view('_staff_b'); } public function _staff_c(){     return view('_staff_c'); } ... 

and routes.php follows:

route::any('_staff_a''maincontroller@_staff_a'); route::any('_staff_b''maincontroller@_staff_b'); ... etc. 

it seems there lot of lines , lot of things change if change mind...

i wondering if can have regex in routes.php , equivalent regex in maincontroller.php handling routes begin underscore (_)?

can laravel experts share tips/suggestions? i'm quite new framework.

sure - add parameter. e.g. this:

route::any('_staff_{version}', 'maincontroller@_staff');  public function _staff($version) {     return view('_staff_'.$version); } 

Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -