Skip to content

Commit

Permalink
Fix late config binding (#5)
Browse files Browse the repository at this point in the history
* Fix late config binding

* Add changelog entry
  • Loading branch information
DannyvdSluijs authored Jul 12, 2020
1 parent 1c9a5b6 commit 738aea7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- Late config binding added for runtime override

## [1.1.1] - 2020-07-12
### Fixed
- Make JsonMapperInterface availalbe in ServiceProvider
- Make JsonMapperInterface available in ServiceProvider

## [1.1.0] - 2020-07-12
### Fixed
Expand Down
4 changes: 2 additions & 2 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public function register()
{
$this->mergeConfigFrom(self::CONFIG_FILE, 'json-mapper');

$config = config('json-mapper.type');
$this->app->singleton(JsonMapperInterface::class, static function () use ($config) {
$this->app->singleton(JsonMapperInterface::class, function ($app) {
$config = $app->get('config')->get('json-mapper.type');
switch ($config) {
case 'best-fit':
return (new JsonMapperFactory())->bestFit();
Expand Down

0 comments on commit 738aea7

Please sign in to comment.