kirschbaum-development/eloquent-power-joins
Add “Laravel way” joins to Eloquent: join via relationship definitions, reuse model scopes in joined contexts, query relationship existence with joins, and sort by related columns/aggregations—cleaner, more readable join queries with less boilerplate.
joinRelationship(), powerJoinHas(), and orderByPowerJoins() are modular and can be adopted incrementally, reducing risk of monolithic integration.joinRelationship('posts') vs. manual join('posts', ...)). This minimizes disruption to existing codebases.whereExists: While powerJoinHas() may improve performance for large datasets (avoiding subqueries), it could degrade performance for complex nested joins or tables with many rows. Benchmarking is critical before adoption.joinRelationship() vs. with().deleted_at filtering adds overhead to queries. Explicitly opting into trashed models (withTrashed()) may not be intuitive for all teams.posts.comments.votes) could lead to overly complex SQL or Cartesian products if not constrained properly. The package mitigates this with callbacks, but misuse risks performance pitfalls.joinRelationshipUsingAlias()) is necessary for self-referential relationships or duplicate table joins, adding complexity.withGlobalScopes()), which may be overlooked.powerJoinHas() against native whereHas() for our dataset size and query patterns? Are there scenarios where whereExists is still preferable?with() vs. joinRelationship())?whereExists that would need refactoring?joinRelationship() for simple 1:many relationships (e.g., User::joinRelationship('posts')).whereHas() with powerJoinHas() for relationships where join performance is suspected to be better.orderByPowerJoins() for sorting by related table fields (e.g., Post::orderByPowerJoinsCount('comments.votes')).whereExists and refactor to use the package’s methods.User::whereHas('posts', fn ($q) => $q->where('posts.published', true)) to User::powerJoinWhereHas('posts', fn ($join) => $join->where('posts.published', true)).joinRelationship().3.* for Laravel <10).Builder or JoinClause (e.g., some audit logging tools).spatie/laravel-medialibrary or laravel-scout if they use joins internally.Model or custom base classes, as long as relationships are defined using standard Eloquent methods.composer require kirschbaum-development/eloquent-power-joins.joinRelationship() vs. with() or raw joins.toSql() to inspect generated queries for correctness.DB::enableQueryLog()) to debug complex joins.where clauses).tntsearch/laravel-query-cache to analyze query performance.select * in joins; explicitly specify columns to reduce memory usage.leftJoinRelationship() for optional relationships to prevent missing data issues.How can I help you explore Laravel packages today?