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/DoctorsHomePage.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 DoctorsHomePage extends Model
{
    use HasFactory;
    use SoftDeletes;

    protected $table = 'doctors_homepage';

    protected $fillable = ['id', 'name', 'specialization','doctor_image','rating','language_spoken','created_at', 'updated_at'];

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

            return $url;
        }

        return null;
    }


}