laravel same route different group code example

Example 1: laravel same route different group

{!!URL::to('chemistry/news')!!}
 {!!URL::to('geography/news')!!}
 {!!URL::to('math/news')!!}

Example 2: laravel same route different group

$myroutes =  function () {
    Route::get('/news', 'NewsController@index')->name('news_index');
    Route::get('/article', 'ArticleController@index')->name('article_index');
};

Route::group(['prefix' => 'chemistry'], $myroutes);
Route::group(['prefix' => 'math'], $myroutes);
Route::group(['prefix' => 'geography'], $myroutes);

Tags:

Misc Example