Skip to content

Commit 7b4ceac

Browse files
author
Lupacescu Eduard
authored
Merge pull request #62 from binaryk/fixes
Scrutinizer Fixes and props
2 parents 007bcea + 9470add commit 7b4ceac

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ If you discover any security related issues, please email eduard.lupacescu@binar
4141
## Credits
4242

4343
- [Eduard Lupacescu](https://github.com/binaryk)
44+
- [Koen Koenster](https://github.com/Koenster)
4445
- [All Contributors](../../contributors)
4546

4647
## License

src/Controllers/RestResponse.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -276,14 +276,6 @@ public function respond($response = null)
276276
foreach ($this->attributes as $attribute => $value) {
277277
$response->{$attribute} = $value;
278278
}
279-
280-
if (is_iterable($response)) {
281-
foreach ($response as $property => $value) {
282-
if ($value instanceof Arrayable) {
283-
$response->{$property} = $value->toArray();
284-
}
285-
}
286-
}
287279
}
288280

289281
return $this->response()->json($response, is_int($this->code()) ? $this->code() : self::REST_RESPONSE_SUCCESS_CODE, $this->headers);

src/Exceptions/RestifyHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use Illuminate\Http\Response;
1919
use Illuminate\Routing\Exceptions\InvalidSignatureException;
2020
use Illuminate\Support\Facades\App;
21-
use Illuminate\Validation\UnauthorizedException;
21+
use Illuminate\Validation\UnauthorizedException as ValidationUnauthorized;
2222
use Illuminate\Validation\ValidationException;
2323
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
2424
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
@@ -90,7 +90,7 @@ public function render($request, Exception $exception)
9090

9191
case $exception instanceof BadRequestHttpException:
9292
case $exception instanceof MethodNotAllowedException:
93-
case $exception instanceof UnauthorizedException:
93+
case $exception instanceof ValidationUnauthorized:
9494
case $exception instanceof UnauthorizedHttpException:
9595
case $exception instanceof UnauthenticateException:
9696
case $exception instanceof ActionUnauthorizedException:

src/Services/Search/SearchService.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
use Illuminate\Database\Eloquent\Builder;
99
use Illuminate\Database\Eloquent\Model;
1010

11+
/**
12+
* Class SearchService.
13+
*
14+
* Props to @Koenster for contribution
15+
*/
1116
class SearchService extends Searchable
1217
{
1318
/**

src/Traits/InteractWithSearch.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,9 @@ public function serializeForIndex(RestifyRequest $request, array $fields = null)
6969
'authorizedToDelete' => $this->authorizedToDelete($request),
7070
]);
7171
}
72+
73+
/**
74+
* @return array
75+
*/
76+
abstract public function toArray();
7277
}

0 commit comments

Comments
 (0)