Laravel Eloquent Relationships Through Macros
Laravel 5.4 / February 02, 2017

Laravel Eloquent Relationships Through Macros

A new feature just merged into Laravel and included in the v5.4.8 update is the ability to define Macros for Eloquent Relationships. To better show how this feature works here is a screenshot by Jordan Pittman who created the original pull request: Here is that same example in a copy and paste friendly version. AppServiceProvider …

Quickly Dumping Laravel Queries
Laravel Tutorials / November 27, 2016

Quickly Dumping Laravel Queries

When you are building an application and utilizing Eloquent it’s very easy to hit the N+1 problem. This is where you select a model and then later use lazy loading to fetch child records. As an example pretend you are selecting a user: User::where(‘name’, ‘Eric’)->first(); Then in your view you might do something like: @foreach …

Easily deleting old soft-deleted records with Quicksand
Laravel Packages / August 31, 2016

Easily deleting old soft-deleted records with Quicksand

When building applications, there are times when you would like to allow users to remove data from their view but keep the record in the database. An example could be allowing a user to delete their account, but you want to give them the opportunity to restart it later. If all their data is completely …

Laravel Packages / May 17, 2016

Query Tracer Package

Laravel Query Tracer is a new package by Trevor Fitzgerald that allows you to find exactly where a query is being called in your app. It works by tapping into Laravel’s global query scopes to do a backtrace and find where a query originated. The package ships with support for the Laravel Debugbar, Clockwork, or …

Laravel Packages / May 04, 2016

Cascading soft deletes with Eloquent

Michael Dyrynda has a new package for cascading soft deletes with Laravel and Eloquent. In scenarios when you delete a parent record – say for example a blog post – you may want to also delete any comments associated with it as a form of self-maintenance of your data. Normally, you would use your database’s …

Laravel Packages / December 04, 2015

Eloquence Package hits V2

Eloquence is a package to extend Laravel 5’s base Eloquent models and it has just hit version 2. Some of the features of the package include: True camelCase support for your model attributes A count cache for related models A sum cache for related models uuids and more… Version 2 features API improvements, a sum …

Laravel Tutorials / September 30, 2015

Learn about pivot tables and many-to-many relationships

Laravel Daily has a new post on pivot tables and many-to-many relationships: I want to talk about a feature of Laravel which is really useful but can be potentially difficult to understand at first. A pivot table is an example of intermediate table with relationships between two other “main” tables. This is a feature that …

News / September 14, 2015

ActiveRecord and the Beauty Lost in Translation

Matthew Machuga writing about the ActiveRecord pattern and his thoughts on it: Sometime in 2014, PHP-land started to debate whether Active Record was a tolerable ORM pattern, and whether one should use Active Record or Data Mapper ORMs. In PHP, this comes down to something like Laravel’s Eloquent ORM as an Active Record implementation vs. …

How To Add Multilingual Support to Eloquent
Laravel Tutorials / September 07, 2015

How To Add Multilingual Support to Eloquent

Did you know that several countries throughout the world have more than one official language? For example, my home country Belgium has three; French, Dutch, and German. Most Belgians also speak English. Laravel’s Eloquent ORM is a very powerful part of Laravel. Unfortunately, it doesn’t provide support for multilingual models out of the box. Adding …

Laravel Tutorials / September 03, 2015

Pushing Polymorphism to the Database

Adam Wathan has a new video on his blog about Pushing Polymorphism to the Database: After my presentation at Laracon this year, a lot of people asked me how I’d take that same polymorphic approach when the objects would have to be retrieved from the database. This screencast covers how I’d approach implementing the same …

Laravel News Partners

Laravel Jobs

Senior Full-Time Laravel Developer (REMOTE)
Vue School
Senior Laravel Developer
Remote, USA & Canada Only
Backend Software Engineer
Remote, USA Only
Backend Software Engineer (x/f/m)
Senior Developer


Join 31,000+ others and never miss out on new tips, tutorials, and more.