clickbar/laravel-custom-relations
Add custom Eloquent relationships to your Laravel models when the built-in relation types don't fit. Define reusable relation classes, apply query constraints, and eager or lazy load them like native relations.
clickbar/laravel-custom-relations lets you define custom Eloquent relationships that go beyond Laravel's built-in hasMany, belongsTo, and friends. It provides a clean, reusable way to express complex or non-standard relations—driven by custom queries, joins, or conditions—while keeping them chainable and lazy-loadable like native relations.
This keeps your models expressive and your relationship logic in one place, instead of scattering query constraints across controllers and scopes. It's ideal for legacy schemas, unusual foreign-key setups, or any relation Laravel doesn't support out of the box.
with()How can I help you explore Laravel packages today?