Skip to content

Instantly share code, notes, and snippets.

View Fed0t's full-sized avatar

Fedot Serghei Fed0t

View GitHub Profile
@Fed0t
Fed0t / NPerGroup.php
Created September 19, 2019 13:06 — forked from jsphpl/NPerGroup.php
laravel-pgsql-n-related-models-per-parent-with-scopes
<?php
namespace App\Models\Traits;
use DB;
/**
* This trait is to work around a problem where a limit on an Eloquent
* relation by default applies to all queried models in total.
*