We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
1 | <?php |
||
5 | trait Create |
||
6 | { |
||
7 | /* |
||
8 | |-------------------------------------------------------------------------- |
||
9 | | CREATE |
||
10 | |-------------------------------------------------------------------------- |
||
11 | */ |
||
12 | |||
13 | /** |
||
14 | * Insert a row in the database. |
||
15 | * |
||
16 | * @param [Request] All input values to be inserted. |
||
17 | * |
||
18 | * @return [Eloquent Collection] |
||
|
|||
19 | */ |
||
20 | 4 | public function create($data) |
|
34 | |||
35 | /** |
||
36 | * Get all fields needed for the ADD NEW ENTRY form. |
||
37 | * |
||
38 | * @return [array] The fields with attributes and fake attributes. |
||
39 | */ |
||
40 | 22 | public function getCreateFields() |
|
44 | |||
45 | /** |
||
46 | * Get all fields with relation set (model key set on field). |
||
47 | * |
||
48 | * @param [string: create/update/both] |
||
49 | * |
||
50 | * @return [array] The fields with model key set. |
||
51 | */ |
||
52 | 15 | public function getRelationFields($form = 'create') |
|
53 | { |
||
54 | 15 | if ($form == 'create') { |
|
55 | 13 | $fields = $this->create_fields; |
|
56 | 13 | } else { |
|
57 | 2 | $fields = $this->update_fields; |
|
58 | } |
||
59 | |||
60 | 15 | $relationFields = []; |
|
61 | |||
62 | 15 | foreach ($fields as $field) { |
|
63 | 14 | if (isset($field['model'])) { |
|
64 | 8 | array_push($relationFields, $field); |
|
65 | 8 | } |
|
66 | |||
67 | 14 | if (isset($field['subfields']) && |
|
68 | 14 | is_array($field['subfields']) && |
|
69 | 14 | count($field['subfields'])) { |
|
70 | foreach ($field['subfields'] as $subfield) { |
||
71 | array_push($relationFields, $subfield); |
||
72 | } |
||
73 | } |
||
74 | 15 | } |
|
75 | |||
76 | 15 | return $relationFields; |
|
77 | } |
||
78 | |||
79 | /** |
||
80 | * Get all fields with n-n relation set (pivot table is true). |
||
81 | * |
||
82 | * @param [string: create/update/both] |
||
83 | * |
||
84 | * @return [array] The fields with n-n relationships. |
||
85 | */ |
||
86 | 7 | public function getRelationFieldsWithPivot($form = 'create') |
|
94 | |||
95 | 8 | public function syncPivot($model, $data, $form = 'create') |
|
123 | } |
||
124 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.