question:
what difference you consider between guest and public routes?
suggestion:
you can include your 'extra route files/sub_route files' in web.php and api.php files (using the php's include()/require()). it has two benefits:
you will not have to define same route in two different files (i.e. in web.php and api.php).
you don't have to write multiple multiple functions in RouteServiceProvider
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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Assalamu Alikum Mohammed Osama,
I have one question and one suggestion.
question:
what difference you consider between guest and public routes?
suggestion:
you can include your 'extra route files/sub_route files' in web.php and api.php files (using the php's include()/require()). it has two benefits:
you will not have to define same route in two different files (i.e. in web.php and api.php).
you don't have to write multiple multiple functions in RouteServiceProvider
Correct me if am wrong
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.