Skip to content

Commit a84b655

Browse files
committed
Fixed Model::all() method to work like regular Laravel and no longer operate on the eloquent query builder
1 parent cb92ea6 commit a84b655

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

src/Database/Eloquent/FMEloquentBuilder.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,6 @@ public function setModel($model, $ids = [])
5555
return $this;
5656
}
5757

58-
/**
59-
* @return Collection
60-
* @throws FileMakerDataApiException
61-
*/
62-
public function all()
63-
{
64-
// Set the limit if the user hasn't already set one
65-
// We're setting a high limit since the data API limits to 100 records by default
66-
// It seems to break if we add any more 0s than 1000000000000000000
67-
// Hopefully nobody is really going to hit this limit.... hopefully....
68-
if ($this->query->limit == null or $this->query->limit == 0) {
69-
$this->query->limit(1000000000000000000);
70-
}
71-
72-
return $this->get();
73-
}
74-
7558

7659
/**
7760
* Determine if any rows exist for the current query.

src/Database/Eloquent/FMModel.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ public function __construct(array $attributes = [])
8383
parent::__construct($attributes);
8484
}
8585

86+
public static function all($columns = ['*'])
87+
{
88+
return static::query()->limit(1000000000000000000)->get(
89+
is_array($columns) ? $columns : func_get_args()
90+
);
91+
}
92+
8693
/**
8794
* Create a model object from the returned FileMaker data
8895
*

0 commit comments

Comments
 (0)