Skip to content

Commit

Permalink
Merge pull request #62 from binaryk/fixes
Browse files Browse the repository at this point in the history
Scrutinizer Fixes and props
  • Loading branch information
Lupacescu Eduard authored Dec 23, 2019
2 parents 007bcea + 9470add commit 7b4ceac
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ If you discover any security related issues, please email eduard.lupacescu@binar
## Credits

- [Eduard Lupacescu](https://github.com/binaryk)
- [Koen Koenster](https://github.com/Koenster)
- [All Contributors](../../contributors)

## License
Expand Down
8 changes: 0 additions & 8 deletions src/Controllers/RestResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,6 @@ public function respond($response = null)
foreach ($this->attributes as $attribute => $value) {
$response->{$attribute} = $value;
}

if (is_iterable($response)) {
foreach ($response as $property => $value) {
if ($value instanceof Arrayable) {
$response->{$property} = $value->toArray();
}
}
}
}

return $this->response()->json($response, is_int($this->code()) ? $this->code() : self::REST_RESPONSE_SUCCESS_CODE, $this->headers);
Expand Down
4 changes: 2 additions & 2 deletions src/Exceptions/RestifyHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use Illuminate\Http\Response;
use Illuminate\Routing\Exceptions\InvalidSignatureException;
use Illuminate\Support\Facades\App;
use Illuminate\Validation\UnauthorizedException;
use Illuminate\Validation\UnauthorizedException as ValidationUnauthorized;
use Illuminate\Validation\ValidationException;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
Expand Down Expand Up @@ -90,7 +90,7 @@ public function render($request, Exception $exception)

case $exception instanceof BadRequestHttpException:
case $exception instanceof MethodNotAllowedException:
case $exception instanceof UnauthorizedException:
case $exception instanceof ValidationUnauthorized:
case $exception instanceof UnauthorizedHttpException:
case $exception instanceof UnauthenticateException:
case $exception instanceof ActionUnauthorizedException:
Expand Down
5 changes: 5 additions & 0 deletions src/Services/Search/SearchService.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;

/**
* Class SearchService.
*
* Props to @Koenster for contribution
*/
class SearchService extends Searchable
{
/**
Expand Down
5 changes: 5 additions & 0 deletions src/Traits/InteractWithSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,9 @@ public function serializeForIndex(RestifyRequest $request, array $fields = null)
'authorizedToDelete' => $this->authorizedToDelete($request),
]);
}

/**
* @return array
*/
abstract public function toArray();
}

0 comments on commit 7b4ceac

Please sign in to comment.