HEX
Server: nginx/1.24.0
System: Linux DGT-WORDPRESS-VM-SERVER 6.14.0-1014-azure #14~24.04.1-Ubuntu SMP Fri Oct 3 20:52:11 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 8.4.12
Disabled: NONE
Upload Files
File: /mnt/data/ghayatcom/ghayatcom-api/app/HomePage.php
<?php

namespace App;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Carbon;
use Storage;
use Config;

class HomePage extends Model
{
    use HasFactory;
    
    protected $table = 'home_page';

    protected $fillable = ['id', 'banner_image', 'created_at', 'updated_at'];

    // public function getBannerImageAttribute($image) {
    //     $S3Library = new \App\Library\S3Library;
    //     $digimedFile = ($S3Library->bannerImage($image));
    //     return $digimedFile;
    // }

    public function getBannerImageAttribute()
    {
       
        $value = $this->attributes['banner_image'] ?? null;
       
        if ($value) {
            if (Config::get('filesystems.default') == 's3') {
                $url = Storage::temporaryUrl(
                    'digimed/images/home-page/banner/1/'. $value,
                    now()->addMinutes(30)
                );
            } else {
                $url = Storage::url('home-page/banner/1/' . $value);
            }

            return $url;
        }

        return null;
    }
}