@@ -36,7 +36,6 @@ public function get($columns = ['*'])
36
36
return $ this ->getModel ()->newCollection ($ models );
37
37
}
38
38
39
-
40
39
/**
41
40
* Set the affected Eloquent model and instance ids.
42
41
*
@@ -72,7 +71,6 @@ public function all()
72
71
return $ this ->get ();
73
72
}
74
73
75
-
76
74
/**
77
75
* Determine if any rows exist for the current query.
78
76
* This actually runs the full query, so it doesn't save you any data, just an error capture
@@ -106,7 +104,6 @@ public function doesntExist()
106
104
return !$ this ->exists ();
107
105
}
108
106
109
-
110
107
/**
111
108
* Add a where clause on the primary key to the query.
112
109
*
@@ -115,7 +112,6 @@ public function doesntExist()
115
112
*/
116
113
public function whereKeyNot ($ id )
117
114
{
118
-
119
115
if (is_array ($ id ) || $ id instanceof Arrayable) {
120
116
$ this ->query ->whereNotIn ($ this ->model ->getQualifiedKeyName (), $ id );
121
117
@@ -127,16 +123,14 @@ public function whereKeyNot($id)
127
123
}
128
124
129
125
// If this is our first where clause we can add the omit directly
130
- if (sizeof ($ this ->wheres ) === 0 ){
126
+ if (count ($ this ->wheres ) === 0 ){
131
127
return $ this ->where ($ this ->model ->getKeyName (), '== ' , $ id )->omit ();
132
128
}
133
129
134
130
// otherwise we need to add a find and omit
135
131
return $ this ->orWhere ($ this ->model ->getKeyName (), '== ' , $ id )->omit ();
136
132
}
137
133
138
-
139
-
140
134
public function findByRecordId ($ recordId )
141
135
{
142
136
$ response = $ this ->query ->findByRecordId ($ recordId );
@@ -145,7 +139,6 @@ public function findByRecordId($recordId)
145
139
return $ newModel ;
146
140
}
147
141
148
-
149
142
/**
150
143
* Get a single column's value from the first result of a query.
151
144
*
@@ -180,16 +173,13 @@ public function editRecord()
180
173
/** @var FMModel $model */
181
174
$ model = $ this ->model ;
182
175
183
-
184
176
// Map the columns to FileMaker fields and strip out read-only fields/containers
185
177
$ fieldsToWrite = $ this ->model ->getAttributesForFileMakerWrite ();
186
178
187
-
188
179
$ modifiedPortals = null ;
189
180
foreach ($ fieldsToWrite as $ key => $ value ) {
190
181
// Check if the field is a portal (it should be an array if it is)
191
182
if (is_array ($ value )) {
192
-
193
183
$ modifiedPortals [$ key ] = $ this ->getOnlyModifiedPortalFields ($ fieldsToWrite [$ key ], $ this ->model ->getOriginal ($ key ));
194
184
$ fieldsToWrite ->forget ($ key );
195
185
}
@@ -219,12 +209,10 @@ public function createRecord()
219
209
/** @var FMModel $model */
220
210
$ model = $ this ->model ;
221
211
222
-
223
212
// Map the columns to FileMaker fields and strip out read-only fields/containers
224
213
$ fieldsToWrite = $ this ->model ->getAttributesForFileMakerWrite ();
225
214
226
215
// we always need to create the record, even if there are no regular or portal fields which have been set
227
-
228
216
// forward this request to a base query builder to execute the create record request
229
217
$ response = $ this ->query ->fieldData ($ fieldsToWrite ->toArray ())->portalData ($ model ->portalData )->createRecord ();
230
218
@@ -250,8 +238,7 @@ protected function getModIdFromFmResponse($response)
250
238
251
239
public function duplicate ()
252
240
{
253
- $ response = $ this ->query ->duplicate ($ this ->model ->getRecordId ());
254
- return $ response ;
241
+ return $ this ->query ->duplicate ($ this ->model ->getRecordId ());
255
242
}
256
243
257
244
/**
@@ -267,7 +254,6 @@ public function duplicate()
267
254
*/
268
255
public function paginate ($ perPage = null , $ columns = ['* ' ], $ pageName = 'page ' , $ page = null )
269
256
{
270
-
271
257
$ page = $ page ?: Paginator::resolveCurrentPage ($ pageName );
272
258
273
259
$ perPage = $ perPage ?: $ this ->model ->getPerPage ();
@@ -363,6 +349,4 @@ protected function getOnlyModifiedPortalFields($array1, $array2): array
363
349
364
350
return $ result ;
365
351
}
366
-
367
-
368
352
}
0 commit comments