Browse and clean up the media library through the API
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,7 @@ class MediaResource extends JsonResource
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
// What a record stores — `featured_image` on a page — and so the one
|
||||
// field a caller has to keep.
|
||||
'path' => $this->path,
|
||||
@@ -30,6 +31,13 @@ class MediaResource extends JsonResource
|
||||
// False until the queue has derived the smaller versions and the
|
||||
// placeholder. The image serves either way.
|
||||
'processed' => $this->isProcessed(),
|
||||
'error' => $this->error,
|
||||
// Only in the library, where it decides whether a file may go.
|
||||
'referenced' => $this->when(
|
||||
array_key_exists('referenced', $this->resource->getAttributes()),
|
||||
fn () => (bool) $this->resource->getAttribute('referenced'),
|
||||
),
|
||||
'created_at' => $this->created_at?->toIso8601String(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user