1 | <?php |
||
2 | |||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
3 | |||
4 | namespace BristolSU\ControlDB\Models; |
||
5 | |||
6 | |||
7 | use BristolSU\ControlDB\AdditionalProperties\HasAdditionalProperties; |
||
8 | use BristolSU\ControlDB\Traits\DataPositionTrait; |
||
9 | use Illuminate\Database\Eloquent\Model; |
||
10 | use Illuminate\Database\Eloquent\SoftDeletes; |
||
11 | |||
12 | /** |
||
13 | * Handles attributes belonging to a position |
||
14 | */ |
||
0 ignored issues
–
show
|
|||
15 | class DataPosition extends Model implements \BristolSU\ControlDB\Contracts\Models\DataPosition |
||
16 | { |
||
17 | use SoftDeletes, HasAdditionalProperties, DataPositionTrait { |
||
18 | setName as baseSetName; |
||
19 | setDescription as baseSetDescription; |
||
20 | } |
||
21 | |||
22 | /** |
||
23 | * Defines the table |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $table = 'control_data_position'; |
||
28 | |||
29 | /** |
||
30 | * Defines the fillable properties |
||
31 | * |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $fillable = [ |
||
35 | 'name', 'description' |
||
36 | ]; |
||
37 | |||
38 | /** |
||
39 | * ID of the position |
||
40 | * |
||
41 | * @return int |
||
42 | */ |
||
43 | 25 | public function id(): int |
|
44 | { |
||
45 | 25 | return $this->id; |
|
46 | } |
||
47 | |||
48 | /** |
||
49 | * Name of the position |
||
50 | * |
||
51 | * @return string|null |
||
52 | */ |
||
53 | 9 | public function name(): ?string |
|
54 | { |
||
55 | 9 | return $this->name; |
|
56 | } |
||
57 | |||
58 | /** |
||
59 | * Description for the position. |
||
60 | * |
||
61 | * @return string|null |
||
62 | */ |
||
63 | 8 | public function description(): ?string |
|
64 | { |
||
65 | 8 | return $this->description; |
|
66 | } |
||
67 | |||
68 | /** |
||
69 | * Set the position name |
||
70 | * |
||
71 | * @param string|null $name |
||
0 ignored issues
–
show
|
|||
72 | */ |
||
0 ignored issues
–
show
|
|||
73 | 2 | public function setName(?string $name): void |
|
74 | { |
||
75 | 2 | $this->baseSetName($name); |
|
76 | 2 | $this->refresh(); |
|
77 | 2 | } |
|
78 | |||
79 | /** |
||
80 | * Set the description |
||
81 | * |
||
82 | * @param string|null $description |
||
0 ignored issues
–
show
|
|||
83 | */ |
||
0 ignored issues
–
show
|
|||
84 | 2 | public function setDescription(?string $description): void |
|
85 | { |
||
86 | 2 | $this->baseSetDescription($description); |
|
87 | 2 | $this->refresh(); |
|
88 | 2 | } |
|
89 | |||
90 | |||
91 | } |