| Total Complexity | 4 |
| Total Lines | 68 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | class Position extends Model implements \BristolSU\ControlDB\Contracts\Models\Position |
||
| 15 | { |
||
| 16 | use SoftDeletes, PositionTrait { |
||
| 17 | setDataProviderId as baseSetDataProviderId; |
||
| 18 | } |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Table to use |
||
| 22 | * |
||
| 23 | * @var string |
||
| 24 | */ |
||
| 25 | protected $table = 'control_positions'; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Fillable attributes |
||
| 29 | * |
||
| 30 | * @var array |
||
| 31 | */ |
||
| 32 | protected $fillable = ['data_provider_id']; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Attributes to append when casting to an array |
||
| 36 | * |
||
| 37 | * @var array |
||
| 38 | */ |
||
| 39 | protected $appends = [ |
||
| 40 | 'data' |
||
| 41 | ]; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * ID of the position |
||
| 45 | * |
||
| 46 | * @return int |
||
| 47 | */ |
||
| 48 | 48 | public function id(): int |
|
| 49 | { |
||
| 50 | 48 | return $this->id; |
|
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * ID of the data provider for the position |
||
| 55 | * |
||
| 56 | * @return int |
||
| 57 | */ |
||
| 58 | 17 | public function dataProviderId(): int |
|
| 59 | { |
||
| 60 | 17 | return $this->data_provider_id; |
|
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * Laravel integration for a data property |
||
| 65 | * |
||
| 66 | * @return \BristolSU\ControlDB\Contracts\Models\DataPosition |
||
| 67 | */ |
||
| 68 | 9 | public function getDataAttribute(): \BristolSU\ControlDB\Contracts\Models\DataPosition |
|
| 69 | { |
||
| 70 | 9 | return $this->data(); |
|
| 71 | } |
||
| 72 | |||
| 73 | /** |
||
| 74 | * Set the ID of the data provider |
||
| 75 | * |
||
| 76 | * @param int $dataProviderId |
||
| 77 | */ |
||
| 78 | 2 | public function setDataProviderId(int $dataProviderId): void |
|
| 82 | 2 | } |
|
| 83 | |||
| 84 | |||
| 85 | } |
||
| 86 |