protected function fileTransformer($file)
 {
     return ['uid' => $file->uid, 'title' => $file->title, 'description' => $file->description, 'tag' => 'file', 'name' => $file->getObjectName(), 'parent_uid' => $file->parent_uid, 'mimeType' => $file->mimeType, 'originalFilename' => $file->originalFilename, 'fileExtension' => $file->fileExtension, 'md5Checksum' => $file->md5Checksum, 'objectSize' => (int) $file->fileSize, 'fq_path' => $file->getFQPath(), 'fq_uid' => $file->getFQUid(), 'ns_path' => $file->getNSPath(), 'downloadUrl' => apiRoute('v1', 'api.documents.file.download', ['pool_id' => $file->pool_uid, 'id' => $file->uid]), 'shared' => (bool) $file->shared, 'owner' => $file->user_id, 'deleted' => (bool) $file->trashed(), 'created_at' => $this->formatDate($file->created_at), 'updated_at' => $this->formatDate($file->updated_at), 'deleted_at' => isset($file->deleted_at) ? $this->formatDate($file->deleted_at) : null, 'pool_uid' => $file->pool_uid];
 }
Example #2
0
 public function transform(Album $album)
 {
     return ['title' => $album->title, 'slug' => $album->slug, 'published' => (bool) $album->published, 'photos_count' => $album->photos->count(), 'links' => ['api' => ['album' => apiRoute('v1', 'api.gallery.album.show', $album->slug), 'photos' => apiRoute('v1', 'api.gallery.album.photo.index', $album->slug)]]];
 }