/home/bdqbpbxa/api-uniferx.goodface.com.ua/app/Http/Resources/Pages/Blog/PostCollection.php
<?php

namespace App\Http\Resources\Pages\Blog;

use Illuminate\Http\Resources\Json\ResourceCollection;

class PostCollection extends ResourceCollection
{
    protected string|null $language;
    protected string|null $country;
    public bool $full;

    public function language($value): static
    {
        $this->language = $value;
        return $this;
    }
    public function country($value): static
    {
        $this->country = $value;
        return $this;
    }

    public function full($value = true): static
    {
        $this->full = $value;
        return $this;
    }

    public function toArray($request){

        return $this->collection->map(function(PostResource $resource) use($request){
            return $resource->language($this->language)->country($this->country)->full($this->full ?? true)->toArray($request);
        })->all();
    }
}