Skip to content

Commit

Permalink
fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
soulaimaneyahya committed Mar 1, 2024
1 parent e94da7a commit 82da2e8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 15 deletions.
16 changes: 16 additions & 0 deletions src/Interfaces/QueryFiltersRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,20 @@
interface QueryFiltersRepositoryInterface
{
public function applyFilters(Collection|EloquentCollection|JsonResource $collection): array|JsonResponse;

public function filterData(
Collection|EloquentCollection|JsonResource $collection,
?string $transformer
): Collection|EloquentCollection|JsonResource;

public function sortData(
Collection|EloquentCollection|JsonResource $collection,
?string $transformer
): Collection|EloquentCollection|JsonResource;

public function cacheData(
Collection|EloquentCollection|JsonResource $collection
): Collection|EloquentCollection|JsonResource;

public function paginateData(Collection|EloquentCollection|JsonResource $collection): array;
}
30 changes: 15 additions & 15 deletions src/Repositories/QueryFiltersRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,6 @@ public function applyFilters(Collection|EloquentCollection|JsonResource $collect
];
}

/**
* Method cacheData
*
* @param Collection|EloquentCollection|JsonResource $collection
*
* @return Collection|EloquentCollection|JsonResource
*/
public function cacheData(
Collection|EloquentCollection|JsonResource $collection
): Collection|EloquentCollection|JsonResource {
return $this->cacheService->remember($this->fullUrl, now()->addSeconds(60), function () use ($collection) {
return $collection;
});
}

/**
* Method filterData
*
Expand Down Expand Up @@ -137,6 +122,21 @@ public function sortData(

return $collection;
}

/**
* Method cacheData
*
* @param Collection|EloquentCollection|JsonResource $collection
*
* @return Collection|EloquentCollection|JsonResource
*/
public function cacheData(
Collection|EloquentCollection|JsonResource $collection
): Collection|EloquentCollection|JsonResource {
return $this->cacheService->remember($this->fullUrl, now()->addSeconds(60), function () use ($collection) {
return $collection;
});
}

/**
* Method paginateData
Expand Down

0 comments on commit 82da2e8

Please sign in to comment.