| 123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace App\Http\Resources;
- use Carbon\Carbon;
- use Illuminate\Http\Request;
- use Illuminate\Http\Resources\Json\JsonResource;
- use Illuminate\Support\Facades\Storage;
- class CompanySettingResource extends JsonResource
- {
- public function toArray(Request $request): array
- {
- return [
- 'id' => $this->id,
- 'hero_background_path' => $this->hero_background_path,
- 'hero_background_url' => $this->hero_background_path
- ? Storage::disk('s3')->temporaryUrl($this->hero_background_path, now()->addHours(24))
- : null,
- 'hero_title' => $this->hero_title,
- 'hero_subtitle' => $this->hero_subtitle,
- 'stat1_value' => $this->stat1_value,
- 'stat1_label' => $this->stat1_label,
- 'stat2_value' => $this->stat2_value,
- 'stat2_label' => $this->stat2_label,
- 'stat3_value' => $this->stat3_value,
- 'stat3_label' => $this->stat3_label,
- 'contact_email' => $this->contact_email,
- 'contact_phone' => $this->contact_phone,
- 'contact_location' => $this->contact_location,
- 'updated_at' => $this->updated_at
- ? Carbon::parse($this->updated_at)->format('Y-m-d H:i:s')
- : null,
- ];
- }
- }
|