How to define route group name in laravel
<p>Is there any way to define the name of route group in laravel?</p>

<p>What I'm trying to accomplish by this is to know that the current request belongs to which group so I can make active the main menu and sub menu by the current route action:</p>

<p>Code:</p>

<pre><code>Route::group(['prefix'=&gt;'accounts','as'=&gt;'account.'], function(){
    Route::get('/', 'AccountController@index')-&gt;name('index');
    Route::get('connect', 'AccountController@connect')-&gt;name('connect');
});

Route::group(['prefix'=&gt;'quotes','as'=&gt;'quote.'], function(){
    Route::get('/', 'QuoteController@index')-&gt;name('index');
    Route::get('connect', 'QuoteController@create')-&gt;name('create');
});
</code></pre>

<p>Navigation HTML Code</p>

<pre><code>&lt;ul&gt;
    &lt;li&gt; // Add class 'active' when any route is open from account route group
        &lt;a href="{{route('account.index')}}"&gt;Accounts&lt;/a&gt;
        &lt;ul&gt;
            &lt;li&gt; // Add class 'active' when connect sub menu is clicked
                &lt;a href="{{route('account.connect')}}"&gt;Connect Account&lt;/a&gt;
            &lt;/li&gt;
        &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt; // Add class 'active' when any route is open from quote route group
        &lt;a href="{{route('quote.index')}}"&gt;Quotes&lt;/a&gt;
        &lt;ul&gt;
            &lt;li&gt; // Add class 'active' when create sub menu is clicked
                &lt;a href="{{route('quote.create')}}"&gt;Create Quote&lt;/a&gt;
            &lt;/li&gt;
        &lt;/ul&gt;
    &lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>Now what I want is to call a function or something which will give me the current route's group name.</p>

<p>Examples:</p>

<ol>
<li>If I'm on index or create page of quotes <code>getCurrentRouteGroup()</code> should return <code>quote</code></li>
<li>If I'm on index or connect page of accounts <code>getCurrentRouteGroup()</code> should return <code>account</code></li>
</ol>