Our blog

How to create migration file with Make:model command

Recently I’ve found out a nice little way to speed up generating of database stuff – I used to use make:migration and make:model Artisan commands separately. Apparently, they can be combined into one.

Tuesday, October 20th, 2015

How to create a Laravel 5 package in 10 easy steps

So you want to create your own package? Surprisingly, this topic has little information online and not properly described in the official docs. Let’s fill in the gaps and create a new Laravel 5 package from scratch.

Monday, October 19th, 2015

Moving Controllers to sub-folders in a correct way

If your application gets bigger, it makes sense to structure Controllers with sub-folders. But it takes a little more effort than just moving the files here and there. Let me explain the structure.

Monday, October 19th, 2015

Timezone settings for created_at and similar fields

If you install a fresh Laravel and create your app, you may notice that all created_at and other timestamp fields in database are being saved in UTC timezone. How to change it? Easy.

Thursday, October 15th, 2015

Eloquent Relationships – with “automatic” orderBy

Quick tip for today – let’s imagine we have a one-to-many relationship between Categories and Products, and we often show list of products here and there in our app. What if we want them ordered by name alphabetically? Should we add orderBy in every query? No, we can define that in relationship itself.

Wednesday, September 30th, 2015

Pivot tables and many-to-many relationships

Today I want to talk about a feature of Laravel which is really useful but can be potentially difficult to understand at first. Pivot table is an example of intermediate table with relationships between two other “main” tables.

Tuesday, September 29th, 2015

Eloquent hasManyThrough: jumping deeper into relationships

Quite often in bigger projects there are DB relationships with more than one level: categories->companies->products, countries->teams->players and similar. If we need to get the list of a deeper level, there’s a quick way of doing that with Eloquent.

Monday, September 28th, 2015

Query Scopes – convenient way to isolate often-used conditions

One of less-known but useful Eloquent functions are scopes – basically, you can define conditions to be re-used in various other places in code. Here’s an overview.

Thursday, September 24th, 2015

PhpStorm: easily create new Laravel project

Today I want to tell about another “trick” – or how to create a Laravel project without Command line or Terminal, directly from PhpStorm.

Wednesday, September 23rd, 2015