Skip to content

Commit

Permalink
fix determine order column name bug
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Oct 14, 2014
1 parent bf577dc commit a8ede61
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Spatie/EloquentSortable/Sortable.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ protected function determineOrderColumnName()
{
if (! isset($this->sortable['order_column_name']) OR $this->sortable['order_column_name'] == '')
{
return 'order_column';
$orderColumnName = 'order_column';
}
else
{
return $this->sortable['order_column_name'];
$orderColumnName = $this->sortable['order_column_name'];
}

return $orderColumnName;
Expand All @@ -40,7 +40,7 @@ protected function determineOrderColumnName()
*/
public function getHighestOrderNumber()
{
return ((int) self::max($this->sortable['order_column_name'])) + 1;
return ((int) self::max($this->determineOrderColumnName())) + 1;
}

/**
Expand All @@ -51,7 +51,7 @@ public function getHighestOrderNumber()
*/
public function scopeOrdered($query)
{
return $query->orderBy($this->sortable['order_column_name']);
return $query->orderBy($this->determineOrderColumnName());
}

/**
Expand Down

0 comments on commit a8ede61

Please sign in to comment.