Skip to content

Commit

Permalink
Merge pull request #27 from inakianduaga/master
Browse files Browse the repository at this point in the history
Added missing gulp build code
  • Loading branch information
Inaki Anduaga committed Jan 28, 2015
2 parents 77210e4 + 45067c8 commit 0c0f892
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Models/ModelWithExternalStorageTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ protected static function boot()
{
parent::boot();

static::injectStorageDriver();
//Attempt to auto-inject the storage driver if we haven't initialized it yet
if(static::$storageDriver === null) {
static::injectStorageDriver();
}

/**
* Creating Event
Expand Down Expand Up @@ -219,12 +222,15 @@ public function syncStorageDriverField()
// ---------------------------

/**
* Inject storage driver and pass configuration
* Inject storage driver and pass configuration using the app IoC container
*/
private static function injectStorageDriver()
{
static::$storageDriver = app(StorageDriver::class);
static::$storageDriver->setConfigKey(static::$storageDriverConfigPath);
//Only attempt to inject driver if there is a IoC binding for the interface
if(App::getBindings()[StorageDriver::class]) {
static::$storageDriver = app(StorageDriver::class);
static::$storageDriver->setConfigKey(static::$storageDriverConfigPath);
}
}

/**
Expand Down

0 comments on commit 0c0f892

Please sign in to comment.