Reputation: 717
I have a Route Group, pasted below, inside of which there is a Route named clients
. I want to use the route()
function in a view
to get that clients
route
. What is the correct string to pass to the function.
The below includes one of the things I tried, in terms of setting up the group, which was to add 'name'=>'company.'
to the Group method arguments. I've tried it with and without a .
after the group name. I'm not sure if I'm going wrong in the way I'm defining the Group, or the way I'm calling route()
, or both.
Route::group(['name' => 'company.', 'middleware' => ['auth'], function () {
Route::get('/clients', 'ClientController@index')->name('clients');
});
If the clients
Route
wasn't inside a Group
, I would get it in my view like this:
route('clients');
I have tried route('company.clients');
with no luck.
Laravel 5.6
Thanks
Upvotes: 0
Views: 38
Reputation: 891
Route::group(['as' => 'company.', 'middleware' => ['auth'], function () {
Route::get('/clients', 'ClientController@index')->name('clients');
});
And now you can use route('company.clients');
Upvotes: 1