Quick Tips

Route Fallback: If No Other Route is Matched

Laravel 5.5.5 introduced a new feature in routing, called Route::fallback(). Basically, if no route is matched, then fallback function is a way...
extending laravel blade

Create Your Own Blade Directive: Example of br2nl in Laravel

Recently I had a task of textarea fields to save data with <brĀ /> for new lines in database but not show them...

How to Quickly Create Laravel User with Tinker

A new 2-minute video showing probably the quickest way to create a new user in Laravel users table.

How to Re-Use The Same FormRequest Class for Both store() and update() Actions

In your CRUD classes, it's good practice to use FormRequest classes for validation. Usually people create one for store() method and one for update() - something like StoreUserRequest and UpdateUserRequest. But maybe it's possible to combine them into one?

Eloquent withCount(): Get Related Records Amount

Eloquent has one less-known function called withCount(): it helps to get the amount of related records inside of the main object. It also works with two layers deep, inside of hasManyThrough relations. Let's take a look.

Group Entries By Day: Collection groupBy() With CallBack Function

Quite often we need to list the table of data not just entry by entry, but grouped by date. Sports games by...

Embed and Parse Youtube/Vimeo Videos with Laravel Embed Package

I've recently found a simple package that helps to transform any URL into embeddable HTML, the best examples are Youtube and Vimeo videos.
Laravel migrations

Quick Tip for Migrations: Check if Table/Column Already Exists

Sometimes, especially in bigger projects, we run into issue of writing a create migration for the same table, or even column that already exist. Luckily, Laravel has a quick way of checking it.
update or create Laravel

Use updateOrCreate() to Run Seeds At Any Time

Database seeding is a convenient function, but it is designed to run once, in the beginning of the project. What if later you want to add some new seeder and unable to run db:seed or migrate:fresh cause current data is already important? There's a cure.
Laravel Blade include

Laravel Blade @include: Three Additional “Helpers”

In Blade language there's a simple @include() command, where you just pass the view path as a parameter. But what if you're not 100% sure if that view exists? Or what if you want to make it a dynamic variable? Let's explore the possibilities.