Author: Modestas Vaitkevicius

Eloquent::when(): No More if-elses for Conditional Queries

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.

Wednesday, October 4th, 2017

Make soft deleted user email available again!

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.

Monday, August 8th, 2016

Laravel Auth: How to disable auto-login after registration?

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!

Monday, August 8th, 2016

Why you shouldn’t set global variables in Base Controller

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.

Monday, June 6th, 2016

Blade tip: @unless instead of @if-statement

Another quick tip for you guys from Laravel world – this time it’s about Blade template engine.

Thursday, March 10th, 2016

Eloquent: how to make a copy of a row

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.

Tuesday, January 19th, 2016

Limit failed login attempts on Laravel Auth

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.

Tuesday, January 5th, 2016

Laravel-datatables: enchant your tables with ease

Today I want to offer you an overview of a package made for integration into Laravel: laravel-datatables. This package allows you to easily create server-side processed DataTables with most of its available functionality while only writing a few lines of code.

Monday, January 4th, 2016