add all controllers logic

This commit is contained in:
root
2026-03-11 17:53:15 -04:00
parent 3e6c577085
commit 2ef71cc92b
421 changed files with 12009 additions and 5211 deletions
@@ -0,0 +1,31 @@
<?php
namespace App\Http\Resources\Staff;
use Illuminate\Http\Resources\Json\ResourceCollection;
class StaffCollection extends ResourceCollection
{
public function toArray($request): array
{
return $this->collection->map(function ($item) use ($request) {
return (new StaffResource($item))->toArray($request);
})->all();
}
public function with($request): array
{
if (!method_exists($this->resource, 'total')) {
return [];
}
return [
'meta' => [
'total' => $this->resource->total() ?? null,
'per_page' => $this->resource->perPage() ?? null,
'current_page' => $this->resource->currentPage() ?? null,
'last_page' => $this->resource->lastPage() ?? null,
],
];
}
}