Skip to content

Commit

Permalink
Add Service Provider
Browse files Browse the repository at this point in the history
  • Loading branch information
mpociot committed Jan 21, 2018
1 parent 93944b3 commit cb42f5d
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
9 changes: 9 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"minicodemonkey/amazon-alexa-php": "^0.1.5"
},
"require-dev": {
"botman/studio-addons": "~1.0",
"illuminate/contracts": "~5.5.0",
"phpunit/phpunit": "~5.0",
"mockery/mockery": "dev-master",
"ext-curl": "*"
Expand All @@ -38,5 +40,12 @@
"scripts": {
"test": "vendor/bin/phpunit",
"cs": "php-cs-fixer fix"
},
"extra": {
"laravel": {
"providers": [
"BotMan\\Drivers\\AmazonAlexa\\Providers\\AmazonAlexaServiceProvider"
]
}
}
}
39 changes: 39 additions & 0 deletions src/Providers/AmazonAlexaServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace BotMan\Drivers\AmazonAlexa\Providers;

use Illuminate\Support\ServiceProvider;
use BotMan\BotMan\Drivers\DriverManager;
use BotMan\Drivers\AmazonAlexa\AmazonAlexaDriver;
use BotMan\Studio\Providers\StudioServiceProvider;

class AmazonAlexaServiceProvider extends ServiceProvider
{
/**
* Perform post-registration booting of services.
*
* @return void
*/
public function boot()
{
if (! $this->isRunningInBotManStudio()) {
$this->loadDrivers();
}
}

/**
* Load BotMan drivers.
*/
protected function loadDrivers()
{
DriverManager::loadDriver(AmazonAlexaDriver::class);
}

/**
* @return bool
*/
protected function isRunningInBotManStudio()
{
return class_exists(StudioServiceProvider::class);
}
}

0 comments on commit cb42f5d

Please sign in to comment.