Skip to content

Commit

Permalink
Allow filters in find
Browse files Browse the repository at this point in the history
  • Loading branch information
kg-bot committed Oct 14, 2019
1 parent 86c21dc commit ad0e42f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Builders/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,13 @@ public function all($filters = [] )

}

public function find( $id )
public function find($id, $filters = [])
{
return $this->request->handleWithExceptions( function () use ( $id ) {
$urlFilters = $this->parseFilters($filters);

$response = $this->request->client->get( "{$this->entity}/{$id}" );
return $this->request->handleWithExceptions(function () use ($id, $urlFilters) {

$response = $this->request->client->get("{$this->entity}/{$id}{$urlFilters}");
$responseData = collect( json_decode( (string) $response->getBody() ) );

return new $this->model( $this->request, $responseData->first() );
Expand Down

0 comments on commit ad0e42f

Please sign in to comment.