Our blog

How to get rid of /home URL for authentication?

This time – a really short tip. In default Laravel Auth functionality there are some predefined values, settings and similar stuff – one of them is redirecting to /home URL after successful login, or if a user is already logged in. What if we don’t have that /home – what if in our case it’s different?

Wednesday, September 2nd, 2015

Auth Login: how to check more than just email/password?

Laravel default authentication is awesome. But by default it works by checking two fields – email and password. What if we have some additional fields to check? For example, if user is approved?

Tuesday, September 1st, 2015

Laravel 5.1.11 introduces ACL system

Another great news for Laravel community – more and more often repeated functions become a part of Laravel framework itself. Today a new addition is Authorization or ACL functionality.

Monday, August 31st, 2015

Eloquent: shorter WHERE clauses with whereField

There’s one really neat Laravel Eloquent function which, from my experience, a lot of developers don’t know. How do we write WHERE clauses on Eloquent queries?

Thursday, August 20th, 2015

Multiple database connections in the same Laravel project

Sometimes there is a situation where we have our main project database, but we need to take some external data from another database – for example, where blog is stored, managed by 3rd party software. How to handle it in Laravel 5?

Tuesday, August 18th, 2015

Eloquent: how to get random rows

Laravel’s Query Builder has a method get() to actually get the rows, but what if we want to get random rows? Like, for example, we have 30 questions in the database, and want to show 10 random ones?

Monday, August 17th, 2015

Laracon US 2015 Recap – main takeaways

Two-day Laracon US Conference has just finished yesterday, and now it’s time to recap all of it. Especially for those who didn’t make it to Louisville (like myself), there’s a ton of public information about everything that has happened there. Let’s dig it all up and try to build a picture.

Thursday, August 13th, 2015

Back to the future: database migrations with dates from the past

Migrations are a really useful tool to keep the database structure in sync with all environments and for all team members. And whenever we generate a new migration – its filename has a pattern of date_time_name.php. But what if you need to add a table which was in the database long time ago and created manually? How to add it into migrations folder and specify its time in the past?

Monday, August 10th, 2015

Blade Foreach: first/last item of the array

Blade templates are mostly for viewing data. But sometimes we do need to add some checks and IF-structures. One of the tricky examples – loop through @foreach but do some action only on first/last element of the array. Blade doesn’t have that functions in itself, so what do we do?

Wednesday, August 5th, 2015