12345678910111213141516171819202122232425262728 |
- <?php
- namespace App\Models;
- class Survey extends Model
- {
- protected $table = 'survey';
- const FORM_PATH = "views/app/patient/surveys/forms/templates";
- const ALLOWED_ENTITIES = [
- 'Client',
- ];
- public function getFieldValue($field){
- $data = json_decode($this->survey_data);
- return @$data->{$field};
- }
- public function getEntity(){
- $entity = null;
- if($this->entity_type === 'Client'){
- $entity = Client::where('uid', $this->entity_uid)->first();
- }
- return $entity;
- }
- }
|