orest
1 month ago
186
4
Laravel

Web and Api middleware - Use cases

Posted 1 month ago by orest

Jeffrey in his videos puts in the web.php all the routes, even routes from Ajax requests, and then he used to get the authenticated user from sessions using auth()->user()

In case that I want to put the Ajax requests in api.php should I use the api middleware for stateless requests and then token based authentication to access the authenticated user Or I can use the web middleware even in api.php ?

Please sign in or create an account to participate in this conversation.