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: '';
}
}