Skip to content

Commit 381f90e

Browse files
author
Michael Deck
committed
Some code style cleanup
1 parent 6e98daa commit 381f90e

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

src/Database/Eloquent/FMEloquentBuilder.php

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public function get($columns = ['*'])
3636
return $this->getModel()->newCollection($models);
3737
}
3838

39-
4039
/**
4140
* Set the affected Eloquent model and instance ids.
4241
*
@@ -72,7 +71,6 @@ public function all()
7271
return $this->get();
7372
}
7473

75-
7674
/**
7775
* Determine if any rows exist for the current query.
7876
* 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()
106104
return !$this->exists();
107105
}
108106

109-
110107
/**
111108
* Add a where clause on the primary key to the query.
112109
*
@@ -115,7 +112,6 @@ public function doesntExist()
115112
*/
116113
public function whereKeyNot($id)
117114
{
118-
119115
if (is_array($id) || $id instanceof Arrayable) {
120116
$this->query->whereNotIn($this->model->getQualifiedKeyName(), $id);
121117

@@ -127,16 +123,14 @@ public function whereKeyNot($id)
127123
}
128124

129125
// 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){
131127
return $this->where($this->model->getKeyName(), '==', $id)->omit();
132128
}
133129

134130
// otherwise we need to add a find and omit
135131
return $this->orWhere($this->model->getKeyName(), '==', $id)->omit();
136132
}
137133

138-
139-
140134
public function findByRecordId($recordId)
141135
{
142136
$response = $this->query->findByRecordId($recordId);
@@ -145,7 +139,6 @@ public function findByRecordId($recordId)
145139
return $newModel;
146140
}
147141

148-
149142
/**
150143
* Get a single column's value from the first result of a query.
151144
*
@@ -180,16 +173,13 @@ public function editRecord()
180173
/** @var FMModel $model */
181174
$model = $this->model;
182175

183-
184176
// Map the columns to FileMaker fields and strip out read-only fields/containers
185177
$fieldsToWrite = $this->model->getAttributesForFileMakerWrite();
186178

187-
188179
$modifiedPortals = null;
189180
foreach($fieldsToWrite as $key => $value) {
190181
// Check if the field is a portal (it should be an array if it is)
191182
if (is_array($value)) {
192-
193183
$modifiedPortals[$key] = $this->getOnlyModifiedPortalFields($fieldsToWrite[$key], $this->model->getOriginal($key));
194184
$fieldsToWrite->forget($key);
195185
}
@@ -219,12 +209,10 @@ public function createRecord()
219209
/** @var FMModel $model */
220210
$model = $this->model;
221211

222-
223212
// Map the columns to FileMaker fields and strip out read-only fields/containers
224213
$fieldsToWrite = $this->model->getAttributesForFileMakerWrite();
225214

226215
// we always need to create the record, even if there are no regular or portal fields which have been set
227-
228216
// forward this request to a base query builder to execute the create record request
229217
$response = $this->query->fieldData($fieldsToWrite->toArray())->portalData($model->portalData)->createRecord();
230218

@@ -250,8 +238,7 @@ protected function getModIdFromFmResponse($response)
250238

251239
public function duplicate()
252240
{
253-
$response = $this->query->duplicate($this->model->getRecordId());
254-
return $response;
241+
return $this->query->duplicate($this->model->getRecordId());
255242
}
256243

257244
/**
@@ -267,7 +254,6 @@ public function duplicate()
267254
*/
268255
public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null)
269256
{
270-
271257
$page = $page ?: Paginator::resolveCurrentPage($pageName);
272258

273259
$perPage = $perPage ?: $this->model->getPerPage();
@@ -363,6 +349,4 @@ protected function getOnlyModifiedPortalFields($array1, $array2): array
363349

364350
return $result;
365351
}
366-
367-
368352
}

src/Database/Query/FMBaseBuilder.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,12 +392,14 @@ public function scriptPrerequest($name, $param = null): FMBaseBuilder
392392
public function scriptPrerequestParam($param): FMBaseBuilder
393393
{
394394
$this->scriptPrerequestParam = $param;
395+
395396
return $this;
396397
}
397398

398399
public function layoutResponse($name): FMBaseBuilder
399400
{
400401
$this->layoutResponse = $name;
402+
401403
return $this;
402404
}
403405

0 commit comments

Comments
 (0)