I have a list of routes mentioned below for your reference. I have to do it as dynamically.
Example:
First set of routes
Route::get('artists/info', 'ArtistApiController@getInfo');
Route::post('artists/records', 'ArtistApiController@postRecords');
Route::post('artists/action', 'ArtistApiController@postAction');
Route::post('artists', 'ArtistApiController@postAdd');
Route::put('artists/update/{id}', 'ArtistApiController@postAdd');
Route::post('artists/update-status/{id}', 'ArtistApiController@postUpdateStatus');
Second set of routes
Route::get('albums/info', 'AlbumApiController@getInfo');
Route::post('albums/records', 'AlbumApiController@postRecords');
Route::post('albums/action', 'AlbumApiController@postAction');
Route::post('albums', 'AlbumApiController@postAdd');
Route::put('albums/update/{id}', 'AlbumApiController@postAdd');
Route::post('albums/update-status/{id}', 'AlbumApiController@postUpdateStatus');
Both routes seem to be the same except for the keyword "albums, artists, AlbumApiController, ArtistApiController". Therefore, I need to do this dynamically in order to reuse this code by passing the necessary parameters. To make it look lower or regardless of syntax, let it be.
grid('albums', 'AlbumApiController');
Thanks in advance
source
share