Add price list management across the API, store, services, routes, navigation, and sales views. Support quotes for either a client or a client group, including PDF download and nullable client validation for group-based recipients. Extend client groups to manage assigned clients directly from the form and detail views, and refresh supplier, intervention, stock, and order screens with updated interactions and layouts.
30 lines
934 B
PHP
30 lines
934 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources\Client;
|
|
|
|
use App\Http\Resources\Client\ClientResource;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class ClientGroupResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'name' => $this->name,
|
|
'description' => $this->description ?? null,
|
|
'clients_count' => $this->whenCounted('clients'),
|
|
'client_ids' => $this->whenLoaded('clients', fn () => $this->clients->pluck('id')->values()),
|
|
'clients' => ClientResource::collection($this->whenLoaded('clients')),
|
|
'created_at' => $this->created_at?->format('Y-m-d H:i:s'),
|
|
'updated_at' => $this->updated_at?->format('Y-m-d H:i:s'),
|
|
];
|
|
}
|
|
}
|