Added Company model, resource and its API.

This commit is contained in:
2023-06-14 16:28:48 +03:00
parent 49f7f06e66
commit 2dc7893eb3
11 changed files with 327 additions and 0 deletions
@@ -0,0 +1,19 @@
<?php
namespace App\Http\Resources\API\v2;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\ResourceCollection;
class CompanyCollection extends ResourceCollection
{
/**
* Transform the resource collection into an array.
*
* @return array<int|string, mixed>
*/
public function toArray(Request $request): array
{
return parent::toArray($request);
}
}
@@ -0,0 +1,25 @@
<?php
namespace App\Http\Resources\API\v2;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class CompanyResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'uuid' => $this->uuid,
'name' => $this->name,
'image' => $this->image,
'description' => $this->description,
];
}
}