Skip to content

Releases: kirschbaum-development/eloquent-power-joins

2.2.1

14 Oct 19:26
067f6db

Choose a tag to compare

Fixes issue #29

2.2.0

09 Oct 00:38
657f223

Choose a tag to compare

Fixed Issue #26.

2.1.0 - Include trashed results

10 Sep 23:50
af4a50d

Choose a tag to compare

Added the ability to include trashed results by using the join callback:

UserProfile::joinRelationship('users', function ($join) {
    $join->withTrashed();
});

```php
UserProfile::joinRelationship('users', function ($join) {
    $join->onlyTrashed();
});

2.0.0

30 Aug 14:37
39e448b

Choose a tag to compare

  • Laravel 8 support;
  • PHP 8 support;
  • A new trait that needs to be used in models;
  • Namespace change which should not affect migrating users from 1.0;
  • Automatically apply extra conditions from the relationship;
  • Ability to order by using left joins;
  • Changed the method signature for sorting;
  • Changed the method signature for querying relationship existence;
  • Bugfixes that were not possible by using the architecture from 1.0;

1.1.1

14 May 22:14
7d8346a

Choose a tag to compare

Bugfixes

#12 - orderByUsingJoins does not get the correct latest relationship model for nested relationships

Added the ability to use table aliases

13 Apr 13:26
e6c7011

Choose a tag to compare

This release implemented the ability to use table aliases in the joins being made. It can be used in two ways.

Automatic

By calling the joinRelationshipUsingAlias method.

Post::joinRelationshipUsingAlias('category.parent')->get();

This generates the following query:

SELECT "posts".* FROM "posts"
    INNER JOIN "categories" AS "40071de3fbcf4e9399e166813abb7718" ON "posts"."category_id" = "40071de3fbcf4e9399e166813abb7718"."id"
    INNER JOIN "categories" AS "ccecda2ab44b29ec904f7bdea7e5aa2e" ON "40071de3fbcf4e9399e166813abb7718"."parent_id" = "ccecda2ab44b29ec904f7bdea7e5aa2e"."id"

By calling ->alias

You can also manually specify the table alias you want to use in the join callbacks.

Post::joinRelationship('category.parent', [
    'parent' => function ($join) {
        $join->as('category_parent');
    },
])->get();

This generates the following query:

SELECT "posts".* FROM "posts"
    INNER JOIN "categories" ON "posts"."category_id" = "categories"."id"
    INNER JOIN "categories" AS "category_parent" ON "categories"."parent_id" = "category_parent"."id"