For a while many of us used to write conditional queries with “if-else”. What if I told you there’s a (much) better way? Easily readable and more Laravel-ish.
When creating user authorization system with soft-deletable data we might encounter a problem: deleted user might try to register with same email address and gets an error that it is in use. What to do in order to prevent it? Here is a quite simple example of how it could be solved.
Laravel default Auth system is great, but sometimes there’s a need that user would register but NOT log in automatically. The problem is that Laravel does auto-login by default after registration. Worry no more, there is a simple solution for that!
Everyone had a situation when one variable had to be accessible in every view file, for some of us it was $user, for others it was $currentPage or any other case dependent variable. And some of you use Base Controller for that. Let me show you why it’s wrong.
Another quick tip for you guys from Laravel world – this time it’s about Blade template engine.
Today I want to tell you about one “hidden” Laravel feature which is in the system but not in documentation – replicate. This function allows you to make a copy of a row in the fastest way possible.
Did you know that Laravel Auth system allows you to block the user after X bad attempts to log in? Even more, you can change that limit! This trick works with out of the box Laravel Auth system and all you have to do is modify one file.