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/UserUpload.php
<?php

namespace App;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Library\S3Library;
use Storage;
use Config;

class UserUpload extends Model
{
    use HasFactory;

    protected $fillable = [
        'user_id', 'address', 'contact_number', 'type', 'chronic_conditions',
        'allergies', 'medications', 'past_surgeries', 'insurance_card', 'lab_results', 'file_path'
    ];

    protected $visible = ['file_path_url', 'type', 'file_path', 'created_at'];

    protected $appends = ['file_path_url'];

    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function getFilePathUrlAttribute()
    {
        $value = $this->file_path;
        if ($value != null) {
            if (Config::get('filesystems.default') == 's3') {
                $url = Storage::temporaryUrl('digimed/images/patient-documents/' . $this->user_id . '/' . $value, now()->addMinutes(30));
            } else {
                $url = Storage::url('app/public/images/documents/' . $this->user_id . '/' . $value);
            }

            return $url;
        } else {
            return null;
        }
    }
}