Total Complexity | 4 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
8 | trait HasProperty |
||
9 | { |
||
10 | /** |
||
11 | * Get the property model. |
||
12 | */ |
||
13 | public function property() |
||
16 | } |
||
17 | |||
18 | /** |
||
19 | * Get the values of the properties. |
||
20 | * |
||
21 | * @return Attribute |
||
22 | */ |
||
23 | protected function properties(): Attribute |
||
24 | { |
||
25 | return Attribute::make( |
||
26 | get: fn() => $this->property?->content ?? [], |
||
27 | ); |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * Save the values of the properties. |
||
32 | * |
||
33 | * @param array $content |
||
34 | * |
||
35 | * @return void |
||
36 | */ |
||
37 | public function saveProperties(array $content) |
||
43 | } |
||
44 | } |
||
45 |