Skip to content

Commit

Permalink
Merge pull request #3766 from jxlwqq/patch-24
Browse files Browse the repository at this point in the history
use version_compare
  • Loading branch information
z-song committed Aug 6, 2019
2 parents ca2270b + d773bd4 commit 72ffec4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Form.php
Expand Up @@ -874,7 +874,7 @@ protected function updateRelation($relationsData)
$parent->save();

// When in creating, associate two models
$foreignKeyMethod = (app()->version() < '5.8.0') ? 'getForeignKey' : 'getForeignKeyName';
$foreignKeyMethod = version_compare(app()->version(), '5.8.0', '<') ? 'getForeignKey' : 'getForeignKeyName';
if (!$this->model->{$relation->{$foreignKeyMethod}()}) {
$this->model->{$relation->{$foreignKeyMethod}()} = $parent->getKey();

Expand Down
2 changes: 1 addition & 1 deletion src/Grid/Model.php
Expand Up @@ -635,7 +635,7 @@ protected function joinParameters(Relation $relation)
$relatedTable = $relation->getRelated()->getTable();

if ($relation instanceof BelongsTo) {
$foreignKeyMethod = (app()->version() < '5.8.0') ? 'getForeignKey' : 'getForeignKeyName';
$foreignKeyMethod = version_compare(app()->version(), '5.8.0', '<') ? 'getForeignKey' : 'getForeignKeyName';

return [
$relatedTable,
Expand Down

0 comments on commit 72ffec4

Please sign in to comment.