Environment:
Laravel: 10.x
PHP: 8.x
Reliese/Laravel: latest (after update)
relation_name_strategy set to 'foreign_key'
Using base mode
Migration examples:
Schema::create('company_following_company', function (Blueprint $table) { //which btw i would love it to be company_followings
$table->foreignId('following_id')->constrained('companies')->cascadeOnDelete();
$table->foreignId('follower_id')->constrained('companies')->cascadeOnDelete();
$table->primary(['company_id', 'follower_id']);
});
Description of the issue:
Reliese generates a generic relation name (companies()) instead of semantic names (followers() / following()) for self-referencing many-to-many pivot tables, even when 'relation_name_strategy' => 'foreign_key' is set.
Expected behavior:
For a self-referencing many-to-many pivot table, Reliese should generate:
public function followers() { ... }
public function following() { ... }
Also the generated extra model doesnt extend type Pivot