Open
Description
Laravel Version
12.19.3
PHP Version
8.3.12
Database Driver & Version
10.1.16-MariaDB
Description
Illuminate\Database\Eloquent\Concerns\HasRelationships::morphToMany() method ignore the parameters $parentKey and $relatedKey.
Steps To Reproduce
// Into the model
public function roles(): MorphToMany
{
return $this->morphToMany(
Role::class,
'name',
'table',
'foreignPivotKey',
'relatedPivotKey',
'parentKey',
'relatedKey'
);
}
But the SQL result was:
SELECT `roles`.*, `table`.`foreignPivotKey` AS `pivot_foreignPivotKey`,
`table`.`relatedPivotKey` AS `pivot_relatedPivotKey`,
`table`.`name_type` AS `pivot_name_type`
FROM `roles`
INNER JOIN `table` ON `roles`.`relatedKey` = `table`.`relatedPivotKey`
WHERE `table`.`foreignPivotKey` IN (?)
AND `table`.`name_type` = "U"