DEV Community

Discussion on: How to separate your Routes at Laravel conveniently.

secmohammed profile image
mohammed osama Author

Salam Naveed,

concerning the question:
the public route doesn't matter whether you are currently authenticated or not, you can view these routes in either case.
guest routes can only be shown when you aren't logged in, such as login/register routes.

concerning the suggestion:
I don't need to require the files inside the web.php/api.php as it will be repetitive for each file we are going to require, we will have to define its middleware which will end up doing the same logic I'm trying to achieve by the service provider, but without writing the same requiring and assigning the middleware.
concerning the first point, It's better to not have the same route at api/web, because they both have different middleware groups.