-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathField.php
More file actions
57 lines (49 loc) · 1.92 KB
/
Field.php
File metadata and controls
57 lines (49 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
/**
* Fields that are provided in an input step. They can be either categorical
* (then they contain a number of options and have empty continuous attributes)
* or continuous (they provide additional attributes)
*
* @property string friendly_title Title that is friendly to a patient
* @property string friendly_description Description that is friendly to a patient
* @property int continuous_field_max Maximum input value (Applies only to
* continuous fields)
* @property int continuous_field_min Minimum input value (Applies only to
* continuous fields)
* @property int continuous_field_step_by Interval between possible input values
* (Applies only to continuous fields)
* @property int continuous_field_unit Unit of the value (kilograms, years, etc.)
* (Applies only to continuous fields)
* @property int evidencio_variable_id Evidencio API variable id associated with
* this field in the designer page
*/
class Field extends Model
{
protected $touches = ['inputSteps'];
public $timestamps = false;
protected $fillable = [
'evidencio_variable_id','friendly_title','friendly_description','continuous_field_max','continuous_field_min','continuous_field_step_by','continuous_field_unit'
];
/**
* Possible options of a field (Applies only to categorical fields)
*/
public function options()
{
return $this->hasMany('App\Option','categorical_field_id');
}
/**
* Input steps that have this field
* @property int order defines index of a field in a step by which it should
* be ordered
*/
public function inputSteps()
{
return $this->belongsToMany('App\Step','field_in_input_steps','field_id','input_step_id')->withPivot("order");
}
public function usedInRunsInSteps()
{
return $this->belongsToMany('App\Step','model_run_field_mappings','field_id','step_id');
}
}