<?php
namespace App\Http\Resources\Pages\Catalogs;
use Illuminate\Http\Resources\Json\ResourceCollection;
class CatalogCollection extends ResourceCollection
{
protected string|null $language;
protected string|null $country;
public function language($value): static
{
$this->language = $value;
return $this;
}
public function country($value): static
{
$this->country = $value;
return $this;
}
public function toArray($request){
return $this->collection->map(function(CatalogResource $resource) use($request){
return $resource->language($this->language)->country($this->country)->toArray($request);
})->all();
}
}