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
Post a Comment