diff --git a/src/Support/Format.php b/src/Support/Format.php index e2f7fce..789eafb 100644 --- a/src/Support/Format.php +++ b/src/Support/Format.php @@ -83,7 +83,7 @@ public function paginator(AbstractPaginator|AbstractCursorPaginator $resource): { return [ 'data' => $resource->toArray()['data'], - 'meta' => $this->formatMeta($resource) + 'meta' => $this->formatMeta($resource), ]; } @@ -97,7 +97,7 @@ public function resourceCollection(ResourceCollection $collection): array { return array_filter([ 'data' => $collection->toArray(request()), - 'meta' => $this->formatMeta($collection->resource) + 'meta' => $this->formatMeta($collection->resource), ]); } @@ -109,7 +109,7 @@ public function resourceCollection(ResourceCollection $collection): array */ public function jsonResource(JsonResource $resource): array { - return value($this->formatJsonResource(),$resource); + return value($this->formatJsonResource(), $resource); } /** @@ -121,7 +121,7 @@ public function jsonResource(JsonResource $resource): array */ protected function formatMessage(int $code, ?string $message): ?string { - if (!$message && class_exists($enumClass = Config::get('response.enum'))) { + if (! $message && class_exists($enumClass = Config::get('response.enum'))) { $message = $enumClass::fromValue($code)->description; } @@ -185,7 +185,7 @@ protected function formatMeta($collection) 'prev' => $collection->previousCursor()?->encode(), 'next' => $collection->nextCursor()?->encode(), 'count' => count($collection->items()), - ] + ], ], $collection instanceof LengthAwarePaginator => [ 'pagination' => [ @@ -226,7 +226,7 @@ protected function formatDataFields(array $data): array $formatConfig = \config('response.format.config', []); foreach ($formatConfig as $key => $config) { - if (!Arr::has($data, $key)) { + if (! Arr::has($data, $key)) { continue; } @@ -239,7 +239,7 @@ protected function formatDataFields(array $data): array $key = $alias; } - if (!$show) { + if (! $show) { $data = Arr::except($data, $key); } }