-
How can I get the
array:1 [▼
0 => array:18 [▼
"id" => 18
"model_id" => 39
"model_type" => "Report"
"collection_name" => "default"
"name" => "20171218125356"
"file_name" => "20171218125356.pdf"
"mime_type" => "application/pdf"
"disk" => "attachments"
"size" => 76630
"manipulations" => []
"custom_properties" => []
"order_column" => 11
"created_at" => "2017-12-18T17:58:46.000000Z"
"updated_at" => "2020-03-12T22:24:18.000000Z"
"responsive_images" => null
"uuid" => "703439a3-73a6-4d95-beb8-caa271908850"
"conversions_disk" => "attachments"
"generated_conversions" => null
]
]
{
"703439a3-73a6-4d95-beb8-caa271908850":{
"name":"20171218125356",
"file_name":"20171218125356.pdf",
"uuid":"703439a3-73a6-4d95-beb8-caa271908850",
"preview_url":"",
"original_url":"\/storage\/18\/20171218125356.pdf",
"order":11,
"custom_properties":[
],
"extension":"pdf",
"size":76630
}
} Edit: I see that public function jsonSerialize()
{
if (! ($this->formFieldName ?? $this->collectionName)) {
return [];
}
return old($this->formFieldName ?? $this->collectionName) ?? $this->map(function (Media $media) {
return [
'name' => $media->name,
'file_name' => $media->file_name,
'uuid' => $media->uuid,
'preview_url' => $media->hasGeneratedConversion('preview') ? $media->getUrl('preview') : '',
'original_url' => $media->getUrl(),
'order' => $media->order_column,
'custom_properties' => $media->custom_properties,
'extension' => $media->extension,
'size' => $media->size,
];
})->keyBy('uuid');
} |
Beta Was this translation helpful? Give feedback.
Answered by
benjivm
Jun 27, 2022
Replies: 1 comment 1 reply
-
Hi benjivm, |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
By not using the provided resource at all and only calling
->toArray()
, as in: