| 1234567891011121314151617181920212223242526 |
- <?php
- namespace App\Http\Resources;
- use Carbon\Carbon;
- use Illuminate\Http\Request;
- use Illuminate\Http\Resources\Json\JsonResource;
- class MediaResource extends JsonResource
- {
- public function toArray(Request $request): array
- {
- return [
- 'id' => $this->id,
- 'type' => $this->type,
- 'source' => $this->source,
- 'source_id' => $this->source_id,
- 'path' => $this->path,
- 'name' => $this->name,
- 'url' => $this->url ? url($this->url) : null,
- 'user_id' => $this->user_id,
- 'created_at' => Carbon::parse($this->created_at)->format('Y-m-d H:i:s'),
- 'updated_at' => Carbon::parse($this->updated_at)->format('Y-m-d H:i:s'),
- ];
- }
- }
|