Skip to content

Commit

Permalink
refactor: remove unneessarry override
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammad-Alavi committed Dec 15, 2024
1 parent c45a462 commit 0079ec6
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions src/Services/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Apiato\Core\Contracts\HasResourceKey;
use Illuminate\Http\JsonResponse;
use League\Fractal\Scope;
use League\Fractal\Serializer\SerializerAbstract;
use League\Fractal\TransformerAbstract;
use Spatie\Fractal\Fractal;
use Spatie\Fractalistic\Exceptions\NoTransformerSpecified;
Expand All @@ -31,29 +30,6 @@ public static function getRequestedIncludes(): array
return static::create()->manager->parseIncludes($requestedIncludes)->getRequestedIncludes();
}

/**
* Create a new Response instance.
*
* @param mixed|null $data
* @param callable|TransformerAbstract|string|null $transformer
* @param SerializerAbstract|string|null $serializer
*/
public static function create($data = null, $transformer = null, $serializer = null): static
{
$response = parent::create($data, $transformer, $serializer);

$response->parseFieldsets(self::getRequestedFieldsets());

return $response;
}

private static function getRequestedFieldsets(): array
{
$requestKey = config('apiato.requests.sparse_fieldsets.request_key');

return request()?->input($requestKey) ?? [];
}

public function createData(): Scope
{
$this->withResourceName($this->defaultResourceName());
Expand Down

0 comments on commit 0079ec6

Please sign in to comment.