{"repo":"kirschbaum-development/eloquent-power-joins","free":true,"listed":false,"github":"https://github.com/kirschbaum-development/eloquent-power-joins","clone":"git clone https://github.com/kirschbaum-development/eloquent-power-joins.git","description":"The Laravel magic you know, now applied to joins.","language":"PHP","stars":1574,"topics":["hacktoberfest","laravel","php"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"The Laravel magic you know, now applied to joins. Joins are very useful in a lot of ways. If you are here, you most likely know about and use them. Eloquent is very powerful, but it lacks a bit of the \"Laravel way\" when using joins. This package make your joins in a more Laravel way, with more readable with less code while hiding implementation details from places they don't need to be exposed. A few things we consider is missing when using joins which are very powerful Eloquent features: Ability to use relationship definitions to make joins; Ability to use model scopes inside different contexts; Ability to query relationship existence using joins instead of where exists; Ability to easily sort results based on columns or aggregations from related tables; You can read a more detailed explanation on the problems this package solves on this blog post. Installation You can install the package via composer: For Laravel versions morphMany - Image ). Besides the regular join, you would also need to apply the where imageable type = Post::class condition, otherwise you could get messy results. Turns out, if you join a polymorphic relationship, Eloquent Power Joins automatically applies this condition for you. You simply need to call the same method. You can also join MorphTo relationships. Note: Querying morph to relationships only supports one morphable type at a time. Applying conditions & callbacks to the joins Now, let's say you want to apply a condition to the join you are makin","default_branch":null,"files":null,"tree":[],"storefront":"/r/kirschbaum-development","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/kirschbaum-development/eloquent-power-joins/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}