In my routes files I have a bunch or routes for testing purposes:
/** testing controllers */
Route::get('viewemail', 'TestController@viewemail');
Route::get('restore', 'TestController@restore');
Route::get('sendemail', 'TestController@send_email');
Route::get('socket', 'TestController@socket');
Route::get('colors', 'TestController@colors');
Route::get('view', 'TestController@view_test');
Route::get('numbers', 'TestController@numbers');
Route::get('ncf', 'TestController@ncf');
Route::get('dates', 'TestController@dates');
Route::get('print', 'TestController@printer');
Route::get('{variable}', 'TestController@execute');
/** End of testing controllers */
I want to eliminate all those routes and simple use the name of the given URL to call and return the method:
I have accomplished that in this way:
Route::get('{variable}', 'TestController@execute');
And in my testing controller:
public function execute($method){
return $this->$method();
}
Basically what I want to know if Laravel has a built in solution to do this, I was reading the documentation but couldn't find any way to accomplish this.