We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When omitting the foreign key name in the definition of a relationship, like so
public function profile() { return $this->belongsTo(Profile::class); }
the foreign key name is automatically generated by Laravel, but the way it generates has changed between 5.3 and 5.4.
In 5.3:
$foreignKey = Str::snake($relation).'_id';
(https://github.com/laravel/framework/blob/5.3/src/Illuminate/Database/Eloquent/Model.php#L776)
In 5.4:
$foreignKey = Str::snake($relation).'_'.$instance->getKeyName();
(https://github.com/laravel/framework/blob/5.4/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php#L112)
This breaks when a table is using a primary key different from "id".
The text was updated successfully, but these errors were encountered:
You can submit a PR for the docs here
Sorry, something went wrong.
Thanks for reporting.
Documented.
No branches or pull requests
When omitting the foreign key name in the definition of a relationship, like so
the foreign key name is automatically generated by Laravel, but the way it generates has changed between 5.3 and 5.4.
In 5.3:
(https://github.com/laravel/framework/blob/5.3/src/Illuminate/Database/Eloquent/Model.php#L776)
In 5.4:
(https://github.com/laravel/framework/blob/5.4/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php#L112)
This breaks when a table is using a primary key different from "id".
The text was updated successfully, but these errors were encountered: