Skip to content

Commit

Permalink
Use getter method for access primary key (laravel#25303)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeroenVanOort authored and EspadaV8 committed Jan 28, 2021
1 parent 589fcc9 commit a609a71
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Eloquent/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,7 @@ public function resolveRouteBinding($value)
*/
public function getForeignKey()
{
return Str::snake(class_basename($this)).'_'.$this->primaryKey;
return Str::snake(class_basename($this)).'_'.$this->getKeyName();
}

/**
Expand Down

0 comments on commit a609a71

Please sign in to comment.