freshbitsweb / laravel-traveller

VS Code extension to travel through your Laravel app by just clicking on links.
5 stars 0 forks source link

Route -> Controller when namespace is defined in an array with group. #2

Closed DesolatorMagno closed 4 years ago

DesolatorMagno commented 4 years ago

I found that the feature Route -> Controller is not working for me when the routes are inside a group that applies a middleware, or other options, and have a function call back

Route::group(['middleware' => ['auth']], function () { // });

As a side note, i tried separating it into 2 group and it did work as intended. Route::middleware(['auth'])->group(function () { // });

gauravmak commented 4 years ago

Thanks for reporting. Currently, it is coded to work with namespace() method calls only. I will check for this.

gauravmak commented 4 years ago

I have made the change to allow the routes inside the group to still work when the closure is the 2nd attribute.

But, supporting the namespace from an array requires extra efforts. Noting that this way of defining groups in not specified anywhere in the Laravel documentation, I would suggest to write route groups as per the documentation : Route::namespace('Admin')->group(function() {...

Thanks.

DesolatorMagno commented 4 years ago

Well, in reality it is in the current version of the documentation for middleware and i see it pretty often. https://laravel.com/docs/7.x/middleware#middleware-groups image

gauravmak commented 4 years ago

Thanks for sharing Reny. I had checked only the Route groups page and said full laravel documentation sorry. I can go for this probably in the future. Although, there are other features pending with priority.