Skip to content

Commit ab6cd91

Browse files
committed
change getFields to model
1 parent c2595f2 commit ab6cd91

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

semver.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"version": "v1.0.0-alpha.2",
2+
"version": "v1.0.0-alpha.3",
33
"last-update-type": "patch"
44
}

src/JsonApiFormatPaginateServiceProvider.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@
22

33
namespace Oscabrera\JsonApiFormatPaginate;
44

5-
use Illuminate\Database\Eloquent\Builder;
5+
use Illuminate\Database\Eloquent\Model;
66
use Illuminate\Support\ServiceProvider;
77

88
class JsonApiFormatPaginateServiceProvider extends ServiceProvider
99
{
1010
public function boot(): void
1111
{
12-
$builder = app(Builder::class);
13-
$builder::macro('getFields', function () {
14-
/** @var Builder $this */
15-
$model = $this->getModel();
16-
return array_merge($model->getFillable(), $model->getHidden()) ?? [];
12+
$model = app(Model::class);
13+
$model::macro('getFields', function () {
14+
/** @var Model $this */
15+
return array_merge($this->getFillable(), $this->getHidden()) ?? [];
1716
});
1817
}
1918
}

0 commit comments

Comments
 (0)