{"repo":"fico7489/laravel-eloquent-join","free":true,"listed":false,"github":"https://github.com/fico7489/laravel-eloquent-join","clone":"git clone https://github.com/fico7489/laravel-eloquent-join.git","description":"This package introduces the join magic for eloquent models and relations.","language":"PHP","stars":340,"topics":["eloquent-join","eloquent-search","eloquent","laravel","eloquent-filters","eloquent-relations"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"Laravel Eloquent Join This package introduces the join magic for eloquent models and relations. Introduction Eloquent is a powerful ORM but its join capabilities are very poor. First Eloquent Problem (sorting) With laravel you can't perform sorting of the relationship fields without manually joining related table which is very awkward. Let me give you a few reasons why. If you have a table with posts and related categories your code might look like this: 1.The first problem is that you need to worry about select. Reason : without select id from the category can be selected and hydrated into the Post model. 2.The second problem is that you need to worry about groupBy . - groupBy('posts.id'); Reason : if the relation is HasOne and there are more than one categories for the post, the query will return more rows for categories. 3.The third problem is that you need to change all other where clauses from : to Reason : a post and category can have \"date\" attribute and in that case without selecting an attribute with table \"ambiguous column\" error will be thrown. 4.The fourth problem is that you are using table names(not models) and this is also bad and awkward. 5.The fifth problem is that you need to worry about soft deletes for joined tables. If the category is using SoftDeletes trait you must add : This package will take care of all above problems for you. Unlike sorting , you can perform filtering on the relationship fields without joining related tables, but this package will gi","default_branch":null,"files":null,"tree":[],"storefront":"/r/fico7489","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/fico7489/laravel-eloquent-join/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."}