Skip to content

Commit

Permalink
Put QueryBuilderRequest in service container
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVanderbist committed Oct 8, 2019
1 parent 197d42f commit e66471c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,10 @@

All notable changes to `laravel-query-builder` will be documented in this file

## 2.3.0 - 2019-10-08

- resolve `QueryBuilderRequest` from service container

## 2.2.1 - 2019-10-03

- fix issue when passing camel-cased includes (#336)
Expand Down
4 changes: 3 additions & 1 deletion src/QueryBuilder.php
Expand Up @@ -33,7 +33,9 @@ public function __construct($builder, ? Request $request = null)

$this->initializeFromBuilder($builder);

$this->request = QueryBuilderRequest::fromRequest($request ?? request());
$this->request = $request
? QueryBuilderRequest::fromRequest($request)
: app(QueryBuilderRequest::class);
}

/**
Expand Down
7 changes: 7 additions & 0 deletions src/QueryBuilderServiceProvider.php
Expand Up @@ -16,4 +16,11 @@ public function boot()

$this->mergeConfigFrom(__DIR__.'/../config/query-builder.php', 'query-builder');
}

public function register()
{
$this->app->bind(QueryBuilderRequest::class, function ($app) {
return QueryBuilderRequest::fromRequest($app['request']);
});
}
}

0 comments on commit e66471c

Please sign in to comment.