Skip to content

Commit 66f8d64

Browse files
authored
Merge pull request #66 from iFreshDevelopment/2.x
Improve compatibility with general eloquent usage and Laravel Nova
2 parents 998f158 + 3ac9449 commit 66f8d64

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/Database/Query/FMBaseBuilder.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,12 @@ public function recordId($recordId)
340340

341341
public function orderBy($column, $direction = self::ASCEND): FMBaseBuilder
342342
{
343+
$direction = match($direction) {
344+
self::ASCEND, 'asc' => self::ASCEND,
345+
self::DESCEND, 'desc' => self::DESCEND,
346+
default => $direction
347+
};
348+
343349
$this->appendSortOrder($column, $direction);
344350

345351
return $this;
@@ -1065,4 +1071,9 @@ protected function invalidOperatorAndValue($operator, $value)
10651071
return is_null($value) && in_array($operator, $this->operators) &&
10661072
! in_array($operator, ['=', '==', '!=', '']);
10671073
}
1074+
1075+
public function getCountForPagination($columns = ['*'])
1076+
{
1077+
return $this->count($columns);
1078+
}
10681079
}

0 commit comments

Comments
 (0)