Skip to content

Commit

Permalink
Merge pull request #36 from SvenSlijkoord/patch-1
Browse files Browse the repository at this point in the history
Fix for getForeignKey() exception on Laravel > 5.8
  • Loading branch information
jasonmccreary committed Jun 22, 2019
2 parents a4111f0 + e18cc36 commit e214e8a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Console/GenerateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ protected function getPropertiesFromMethods($model)
if ($relationObj instanceof Relation) {
$relatedModel = '\\' . get_class($relationObj->getRelated());
$relatedObj = new $relatedModel;
$property = property_exists($relationObj, 'getForeignKeyName')
$property = method_exists($relationObj, 'getForeignKeyName')
? $relationObj->getForeignKeyName()
: $relationObj->getForeignKey();
$this->setProperty($property, 'factory(' . get_class($relationObj->getRelated()) . '::class)->create()->' . $relatedObj->getKeyName());
Expand Down

0 comments on commit e214e8a

Please sign in to comment.