Merge Books class with BookInfo model and create services and resources

This commit is contained in:
DariusIII
2025-12-23 12:25:47 +01:00
parent acab740a5d
commit fb53c09671
8 changed files with 209 additions and 43 deletions
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\ResourceCollection;
/**
* Book Collection API Resource for transforming book collections.
*/
class BookCollection extends ResourceCollection
{
/**
* The resource that this resource collects.
*
* @var string
*/
public $collects = BookResource::class;
/**
* Transform the resource collection into an array.
*
* @return array<int|string, mixed>
*/
public function toArray(Request $request): array
{
return [
'data' => $this->collection,
];
}
}