locale = $locale; } public function transform(Document $document) { $translatedFile = $document->getTranslations('file',[$this->locale]); $file = $translatedFile ? url(Str::replaceFirst('public/', '', $translatedFile[$this->locale])) : '-'; return [ 'id' => $document->id, 'title' => $document->getTranslations('title',[$this->locale])[$this->locale] ?? '-', 'file' => $file, ]; } }