@@ -60,9 +60,11 @@ public function update($models, $id, Request $request)
60
60
61
61
$ input = $ request ->all ();
62
62
63
- foreach ($ model ::fields () as $ field ){
64
- if (array_key_exists ($ field ->name , $ input )){
65
- $ input [$ field ->name ] = $ field ->preProcessInput ($ input [$ field ->name ], $ request , $ model );
63
+ if ($ model ::fields ()) {
64
+ foreach ($ model ::fields () as $ field ) {
65
+ if (array_key_exists ($ field ->name , $ input )) {
66
+ $ input [$ field ->name ] = $ field ->preProcessInput ($ input [$ field ->name ], $ request , $ model );
67
+ }
66
68
}
67
69
}
68
70
@@ -84,9 +86,11 @@ public function update($models, $id, Request $request)
84
86
85
87
$ model ->update ($ input );
86
88
87
- foreach ($ model ::fields () as $ field ){
88
- if (array_key_exists ($ field ->name , $ input )){
89
- $ input [$ field ->name ] = $ field ->postProcessInput ($ input [$ field ->name ], $ request , $ model );
89
+ if ($ model ::fields ()) {
90
+ foreach ($ model ::fields () as $ field ) {
91
+ if (array_key_exists ($ field ->name , $ input )) {
92
+ $ input [$ field ->name ] = $ field ->postProcessInput ($ input [$ field ->name ], $ request , $ model );
93
+ }
90
94
}
91
95
}
92
96
@@ -110,9 +114,11 @@ public function store($models, Request $request)
110
114
111
115
$ input = $ request ->all ();
112
116
113
- foreach ($ TLAPModel ::fields () as $ field ){
114
- if (array_key_exists ($ field ->name , $ input )){
115
- $ input [$ field ->name ] = $ field ->preProcessInput ($ input [$ field ->name ], $ request );
117
+ if ($ TLAPModel ::fields ()) {
118
+ foreach ($ TLAPModel ::fields () as $ field ) {
119
+ if (array_key_exists ($ field ->name , $ input )) {
120
+ $ input [$ field ->name ] = $ field ->preProcessInput ($ input [$ field ->name ], $ request );
121
+ }
116
122
}
117
123
}
118
124
@@ -130,9 +136,11 @@ public function store($models, Request $request)
130
136
131
137
$ createdModel = $ TLAPModel ::create ($ input );
132
138
133
- foreach ($ createdModel ::fields () as $ field ){
134
- if (array_key_exists ($ field ->name , $ input )){
135
- $ input [$ field ->name ] = $ field ->postProcessInput ($ input [$ field ->name ], $ request , $ createdModel );
139
+ if ($ createdModel ::fields ()) {
140
+ foreach ($ createdModel ::fields () as $ field ) {
141
+ if (array_key_exists ($ field ->name , $ input )) {
142
+ $ input [$ field ->name ] = $ field ->postProcessInput ($ input [$ field ->name ], $ request , $ createdModel );
143
+ }
136
144
}
137
145
}
138
146
0 commit comments