eloquent-power-joins
eloquent-power-joins copied to clipboard
The Laravel magic you know, now applied to joins.
Versions of packages used and PHP. PHP: 8.1 Laravel: 9.16 Eloquent-power-joins: 2.6.4 If I set an alias to the main model from which the relationships originate, the relationships fail, because...
Possibility to indicate join type for each relation in joinRelationship callbacks: User::joinRelationship('posts.comments', [ 'posts' => function ($join) { $join->where('posts.published', true); }, 'comments' => function ($join) { $join->where('comments.approved', true); $join->left(); //...
I have these two examples: ` $queryBuilder1 = User::query()->joinRelationship('posts.comments', [ 'posts' => function ($join) { $join->where('posts.published', true); }, ]); ` and ` $queryBuilder2 = User::query()->joinRelationship('posts', [ 'posts' => function ($join)...
This is from PowerJoinClause:136:143 ```php public function where($column, $operator = null, $value = null, $boolean = 'and') { if ($this->alias && is_string($column) && Str::contains($column, $this->tableName)) { $column = str_replace("{$this->tableName}.", "{$this->alias}.",...
Hey Guys, I'm pulling out my hair with this issue since it does not make sense. I hope it's a bug, or something you guys can maybe point me in...
Hi, I use ```php ->JoinRelationship('groups.roles.permissions.module', $powerJoinClause); ``` with ```php $powerJoinClause = [ 'permissions' => [ 'permissions' => function ($join) use ($permissionName) { $join->name($permissionName); }, ], 'module' => function ($join) use...
Hi, I am using leftJoinRelationshipUsingAlias. This simple example should return both table ids but w_id is returning null. ``` ConversionOptionsNew::optionType('wheel-style') ->active() ->inOrder() ->leftJoinRelationshipUsingAlias('wheelSize', 'wheel_size') ->select('conversion_options_new.id', 'wheel_size.id as w_id') ->get(); ```...
### Steps to reproduce Laravel 8.0 MySql 5.7 PHP 7.4 ``` class Product extends Model { public function productCategories() { return $this->hasMany(ProductCategory::class, 'product_id', 'id'); } } public function scopeType($q, $type)...
Hi, PowerJoins does not work with belongToMany when we use custom related key (6th parameter), for example : ` return $this->belongsToMany("\App\Models\Material", "CUSTOMER_MATERIAL", "CUSTNO", "CARNO", "CUSTNO", "CARNO");` Generated query is :...
The joins do not consider if the relationship they are pointing to belongs to another database (within the same server). Also if they have different prefixes, just add the prefix...