| 1 | <?php |
||
| 14 | class FieldModel extends Model |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * database Table |
||
| 18 | * @var string |
||
| 19 | */ |
||
| 20 | protected $table = "app_entities_fields"; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Fillable columns |
||
| 24 | * @var array |
||
| 25 | */ |
||
| 26 | protected $fillable = [ |
||
| 27 | 'entity_id', |
||
| 28 | 'namespace', |
||
| 29 | 'name', |
||
| 30 | 'slug', |
||
| 31 | 'description', |
||
| 32 | 'type', |
||
| 33 | 'default', |
||
| 34 | 'required', |
||
| 35 | 'locked', |
||
| 36 | 'create_field', |
||
| 37 | 'options', |
||
| 38 | 'order' |
||
| 39 | ]; |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Related entity |
||
| 43 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
| 44 | */ |
||
| 45 | public function entity() |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Returns a FieldType Class for the field |
||
| 52 | * @return \Illuminate\Foundation\Application|mixed |
||
| 53 | */ |
||
| 54 | public function getType() |
||
| 59 | |||
| 60 | /** |
||
| 61 | * Filter By Entity ID |
||
| 62 | * @param $query |
||
| 63 | * @param $id |
||
| 64 | * @return mixed |
||
| 65 | */ |
||
| 66 | public function scopeByEntity($query, $id) |
||
| 70 | |||
| 71 | /** |
||
| 72 | * Return a Fractal Scope Intance for the model. |
||
| 73 | * @return \League\Fractal\Scope |
||
| 74 | */ |
||
| 75 | public function transformed() |
||
| 81 | } |
||
| 82 |