Laravel Pro Tips
#middleware
Laravel Tip 💡 When you want to share the same route based on user role, you can use a middleware to bind the suitable controller conditionally to an alias and then use it in the route closure. #Laravel
Mhamed Talhaouy 🪐
#authentication #middleware
How to implement multi-login redirections in @laravelphp, you can use middleware to check the user's role and redirect them to the appropriate page #Laravel #laravelphp
Marouan Afkir
#admin #middleware
#Laravel Tip: If your user only has a role of admin or user, you can create a column of 'is_admin' (boolean type) in the users table and create a custom middleware to check if user is admin or not.
andywong31
#requests #middleware
Laravel Tip 💡 Did you know you can enrich request data using a middleware? For example, resolve the user origin country using their IP and add the country abbreviation to the request.
Philo Hermans
You can exclude middleware at the route level in Laravel using the withoutMiddleware method.
Alex Garrett-Smith
Jan 12th, 2023
#routes #controllers #middleware
Laravel Middleware: Put in Routes, Controller, or Elsewhere? (4 Options)
If you have a Middleware, where you should use it: in the Routes file or in the Controller? Here are the FOUR options.