-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php namespace Aws\Laravel; | ||
use Aws\Sdk; | ||
use Illuminate\Foundation\Application as LaravelApplication; | ||
use Illuminate\Support\ServiceProvider; | ||
use Laravel\Lumen\Application as LumenApplication; | ||
class AwsServiceProvider extends ServiceProvider | ||
{ | ||
const VERSION = '3.6.0'; | ||
protected $defer = true; | ||
public function boot() | ||
{ | ||
if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) { | ||
$this->publishes( | ||
[__DIR__.'/../config/aws_publish.php' => config_path('aws.php')], | ||
'aws-config' | ||
); | ||
} elseif ($this->app instanceof LumenApplication) { | ||
$this->app->configure('aws'); | ||
} | ||
} | ||
public function register() | ||
{ | ||
$this->mergeConfigFrom( | ||
__DIR__.'/../config/aws_default.php', | ||
'aws' | ||
); | ||
|
||
$this->app->singleton('aws', function ($app) { | ||
$config = $app->make('config')->get('aws'); | ||
|
||
return new Sdk($config); | ||
}); | ||
|
||
$this->app->alias('aws', 'Aws\Sdk'); | ||
} | ||
public function provides() | ||
{ | ||
return ['aws', 'Aws\Sdk']; | ||
} | ||
|
||
} |