Skip to content

Commit b3757bc

Browse files
committed
Tidy minor issues
1 parent a1bb998 commit b3757bc

File tree

4 files changed

+9
-27
lines changed

4 files changed

+9
-27
lines changed

src/Http/Controllers/Api/Controller.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ public function __construct(Request $request)
8080
$this->request = $request;
8181
$this->uriParser = new UriParser($request, config('laravel-api-controller.parameters.filter'));
8282
$this->user = auth()->user();
83-
$str = 'providers';
84-
8583
}
8684

8785

src/Repository/BaseRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,9 @@ public function get(array $columns = ['*'])
244244
* @param array $columns
245245
*
246246
* @throws ModelNotFoundException
247-
* @return Collection|Model
247+
* @return Model
248248
*/
249-
public function getById($id, array $columns = ['*'])
249+
public function getById($id, array $columns = ['*']) : Model
250250
{
251251
$this->unsetClauses();
252252

src/Traits/Parser.php

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -221,44 +221,28 @@ protected function setWhereClause($where) : void
221221
*/
222222
protected function parseFieldParams() : array
223223
{
224-
$attributes = $this->model->attributesToArray();
224+
225225
$fields = $this->request->has('fields') && ! empty($this->request->input('fields')) ? explode(',', $this->request->input('fields')) : $this->defaultFields;
226226
foreach ($fields as $k => $field) {
227227
if (
228228
$field === '*' ||
229-
in_array($field, $this->getTableColumns()) /* ||
230-
array_key_exists($field, $attributes) */
229+
in_array($field, $this->getTableColumns())
231230
) {
232231
continue;
233232
}
234-
if (strpos($field, '.') > 0) {
235-
//@TODO check if mapped field exists
236-
//@todo
237-
// $fieldParts = explode(".", $field);
238-
// $join = $fieldParts[0];
239-
// $joinField = $fieldParts[1];
240-
// $sub = $this->model->{$join}()->getRelated();
241-
242-
// \dd($this->model->{$join}()->getRelated());
243-
244-
unset($fields[$k]);
245-
continue;
246-
}
247-
248233
unset($fields[$k]);
249-
250234
}
251235

252236
return $fields;
253237
}
254238

255239
/**
256-
* Parses an includes fields and returns as an array or null if none
257-
* @param $include - the table definer
240+
* Parses an includes fields and returns as an array
241+
* @param string $include - the table definer
258242
*
259-
* @return array|null
243+
* @return array
260244
*/
261-
protected function getIncludesFields($include) : ?array
245+
protected function getIncludesFields(string $include) : array
262246
{
263247
$fields = $this->request->has('fields') && ! empty($this->request->input('fields')) ? explode(',', $this->request->input('fields')) : $this->defaultFields;
264248
foreach($fields as $k =>$field){

src/Traits/Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ protected function respondWithMany($items)
8484
/**
8585
* Created Response.
8686
*
87-
* @param int|array $id id of insterted data
87+
* @param mixed $id id of insterted data
8888
* @param string $message message to respond with
8989
*
9090
* @return Res

0 commit comments

Comments
 (0)