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 setting the primary key on a model like that:
class Category extends Model { protected $primaryKey = 'hash'; }
And then calling the getForeignKey() method still returns category_id. For the moment, the method is implemented like that:
getForeignKey()
category_id
public function getForeignKey() { return Str::snake(class_basename($this)).'_id'; }
My proposition would just to make:
public function getForeignKey() { return Str::snake(class_basename($this)).'_' . $this->primaryKey; }
Is their a particular reason the foreign key does not depend on the primary one?
If not, I would be very happy to make a pull request...
The text was updated successfully, but these errors were encountered:
Makes sense to me! Can imagine this would break a few builds though
Sorry, something went wrong.
@ElMatella Added a PR for this.
Moving the discussion to the PR.
No branches or pull requests
Description:
When setting the primary key on a model like that:
And then calling the
getForeignKey()
method still returnscategory_id
. For the moment, the method is implemented like that:My proposition would just to make:
Is their a particular reason the foreign key does not depend on the primary one?
If not, I would be very happy to make a pull request...
The text was updated successfully, but these errors were encountered: