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

namespace App;

use App\HealthRecordSymptoms;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Storage;

/**
 * App\HealthProfile
 *
 * @property mixed $symptom_name
 * @property mixed $diagnosis
 * @property mixed $different_diagnosis
 * @property mixed $treatment_given
 * @property mixed $recommeded_follow_up
 * @property mixed $other_comments
 * @property mixed $other_symptom
 * @property mixed $grading
 * @property mixed $infertility
 * @property mixed $stds
 * @property mixed $contraception
 * @property mixed $dribbling
 * @property mixed $pain_scale
 * @property mixed $last_menstrual_period
 * @property mixed $pregnant
 * @property mixed $miscarriages
 * @property mixed $length_of_periods
 * @property mixed $libido
 * @property mixed $status
 * @property mixed $listsymptoms
 * @property array $templateSymptoms
 */
class HealthRecords extends Model
{
    use SoftDeletes;

    // protected $appends = ['template_symptoms_str'];
    protected $hidden = ['deleted_by', 'deleted_at', 'created_by'];

    public function templateSymptoms(): HasMany{
         return $this->hasMany(HealthRecordSymptoms::class, 'health_record_id', 'id');
    }
    // public function getTemplateSymptomsStrAttribute(){
    //     if(!empty($this->template_symptoms))
    //     {
    //         $symptoms = explode(",",$this->template_symptoms);
    //         $out = array();
    //         foreach($symptoms as $key => $value){
    //             $val = DoctorSymptoms::select('symptom_name')->find($value);
    //             $out[] = $val->symptom_name;
    //         }

    //         return $out;
    //     } else {
    //         return '';
    //     }
    // }

    public function getPdfAttribute($value)
    {
        $S3Library = new \App\Library\S3Library;
        $digimedFile = ($S3Library->s3Url($value, null, 'digimed/images/health_records'));
        return (isset($value)) ? $digimedFile: '';
    }
}