mirror of
https://github.com/fleetbase/fleetbase.git
synced 2026-01-06 06:15:51 +00:00
Remove deprecated l4 and l5 references
This commit is contained in:
@@ -21,9 +21,9 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^2.16",
|
||||
"illuminate/console": "~4||~5",
|
||||
"illuminate/support": "~4||~5",
|
||||
"phpunit/phpunit": "~8.0"
|
||||
"illuminate/console": "~6||~7",
|
||||
"illuminate/support": "~6||~7",
|
||||
"phpunit/phpunit": "^8.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
@@ -43,7 +43,7 @@ class TwilioCallCommand extends Command
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function fire()
|
||||
public function handle()
|
||||
{
|
||||
$this->line('Creating a call via Twilio to: '.$this->argument('phone'));
|
||||
|
||||
@@ -51,7 +51,7 @@ class TwilioCallCommand extends Command
|
||||
$from = $this->option('from');
|
||||
$url = $this->option('url');
|
||||
|
||||
// Set a default URL if we havent specified one since is mandatory.
|
||||
// Set a default URL if we haven't specified one since is mandatory.
|
||||
if (is_null($url)) {
|
||||
$url = 'http://demo.twilio.com/docs/voice.xml';
|
||||
}
|
||||
@@ -59,14 +59,6 @@ class TwilioCallCommand extends Command
|
||||
$this->twilio->call($this->argument('phone'), $url, [], $from);
|
||||
}
|
||||
|
||||
/**
|
||||
* Proxy method for Laravel 5.1+.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
return $this->fire();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command arguments.
|
||||
*
|
||||
|
||||
@@ -59,14 +59,6 @@ class TwilioSmsCommand extends Command
|
||||
$this->twilio->message($this->argument('phone'), $text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Proxy method for Laravel 5.1+.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
return $this->fire();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command arguments.
|
||||
*
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Aloha\Twilio\Support\Laravel;
|
||||
|
||||
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
|
||||
|
||||
class L4ServiceProvider extends LaravelServiceProvider
|
||||
{
|
||||
use ServiceProviderTrait;
|
||||
|
||||
/**
|
||||
* Boot Method.
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
// Register commands.
|
||||
$this->commands('twilio.sms', 'twilio.call');
|
||||
$this->package('aloha/twilio');
|
||||
}
|
||||
|
||||
protected function config()
|
||||
{
|
||||
return $this->app['config']->get('twilio::twilio');
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Aloha\Twilio\Support\Laravel;
|
||||
|
||||
use Aloha\Twilio\Commands\TwilioCallCommand;
|
||||
use Aloha\Twilio\Commands\TwilioSmsCommand;
|
||||
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
|
||||
|
||||
class L5ServiceProvider extends LaravelServiceProvider
|
||||
{
|
||||
use ServiceProviderTrait;
|
||||
|
||||
/**
|
||||
* Boot method.
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->publishes([
|
||||
__DIR__.'/../../config/config.php' => config_path('twilio.php'),
|
||||
], 'config');
|
||||
|
||||
$this->mergeConfigFrom(__DIR__.'/../../config/config.php', 'twilio');
|
||||
|
||||
$this->commands([
|
||||
TwilioCallCommand::class,
|
||||
TwilioSmsCommand::class,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function config()
|
||||
{
|
||||
return $this->app['config']->get('twilio.twilio');
|
||||
}
|
||||
}
|
||||
@@ -2,47 +2,56 @@
|
||||
|
||||
namespace Aloha\Twilio\Support\Laravel;
|
||||
|
||||
use Aloha\Twilio\Commands\TwilioCallCommand;
|
||||
use Aloha\Twilio\Commands\TwilioSmsCommand;
|
||||
use Aloha\Twilio\Manager;
|
||||
use Aloha\Twilio\TwilioInterface;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
|
||||
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
|
||||
|
||||
class ServiceProvider extends LaravelServiceProvider
|
||||
class ServiceProvider extends BaseServiceProvider
|
||||
{
|
||||
/**
|
||||
* @var \Illuminate\Support\ServiceProvider
|
||||
* Register the service provider.
|
||||
*/
|
||||
protected $provider;
|
||||
public function register()
|
||||
{
|
||||
// Register manager for usage with the Facade.
|
||||
$this->app->singleton('twilio', function() {
|
||||
$config = $this->app['config']->get('twilio.twilio');
|
||||
|
||||
return new Manager($config['default'], $config['connections']);
|
||||
});
|
||||
|
||||
// Define an alias.
|
||||
$this->app->alias('twilio', Manager::class);
|
||||
|
||||
// Register Twilio Test SMS Command.
|
||||
$this->app->singleton('twilio.sms', TwilioSmsCommand::class);
|
||||
|
||||
// Register Twilio Test Call Command.
|
||||
$this->app->singleton('twilio.call', TwilioCallCommand::class);
|
||||
|
||||
// Register TwilioInterface concretion.
|
||||
$this->app->singleton(TwilioInterface::class, function() {
|
||||
return $this->app->make('twilio')->defaultConnection();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Boot method.
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
return $this->provider()->boot();
|
||||
}
|
||||
$this->publishes([
|
||||
__DIR__.'/../../config/config.php' => config_path('twilio.php'),
|
||||
], 'config');
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
return $this->provider()->register();
|
||||
}
|
||||
$this->mergeConfigFrom(__DIR__.'/../../config/config.php', 'twilio');
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Support\ServiceProvider
|
||||
*/
|
||||
protected function provider()
|
||||
{
|
||||
if ($this->provider) {
|
||||
return $this->provider;
|
||||
}
|
||||
|
||||
if (version_compare(Application::VERSION, '5.0', '<')) {
|
||||
$this->provider = new L4ServiceProvider($this->app);
|
||||
} else {
|
||||
$this->provider = new L5ServiceProvider($this->app);
|
||||
}
|
||||
|
||||
return $this->provider;
|
||||
$this->commands([
|
||||
TwilioCallCommand::class,
|
||||
TwilioSmsCommand::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Aloha\Twilio\Support\Laravel;
|
||||
|
||||
use Aloha\Twilio\Commands\TwilioCallCommand;
|
||||
use Aloha\Twilio\Commands\TwilioSmsCommand;
|
||||
use Aloha\Twilio\Manager;
|
||||
use Aloha\Twilio\TwilioInterface;
|
||||
|
||||
trait ServiceProviderTrait
|
||||
{
|
||||
public function register()
|
||||
{
|
||||
// Register manager for usage with the Facade.
|
||||
$this->app->singleton('twilio', function() {
|
||||
$config = $this->config();
|
||||
|
||||
return new Manager($config['default'], $config['connections']);
|
||||
});
|
||||
|
||||
// Define an alias.
|
||||
$this->app->alias('twilio', Manager::class);
|
||||
|
||||
// Register Twilio Test SMS Command.
|
||||
$this->app->singleton('twilio.sms', TwilioSmsCommand::class);
|
||||
|
||||
// Register Twilio Test Call Command.
|
||||
$this->app->singleton('twilio.call', TwilioCallCommand::class);
|
||||
|
||||
// Register TwilioInterface concretion.
|
||||
$this->app->singleton(TwilioInterface::class, function() {
|
||||
return $this->app->make('twilio')->defaultConnection();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
return [
|
||||
'twilio' => [
|
||||
'default' => 'twilio',
|
||||
|
||||
'connections' => [
|
||||
'twilio' => [
|
||||
/*
|
||||
@@ -14,7 +13,6 @@ return [
|
||||
| Your Twilio Account SID #
|
||||
|
|
||||
*/
|
||||
|
||||
'sid' => env('TWILIO_SID', ''),
|
||||
|
||||
/*
|
||||
@@ -25,7 +23,6 @@ return [
|
||||
| Access token that can be found in your Twilio dashboard
|
||||
|
|
||||
*/
|
||||
|
||||
'token' => env('TWILIO_TOKEN', ''),
|
||||
|
||||
/*
|
||||
@@ -36,7 +33,6 @@ return [
|
||||
| The Phone number registered with Twilio that your SMS & Calls will come from
|
||||
|
|
||||
*/
|
||||
|
||||
'from' => env('TWILIO_FROM', ''),
|
||||
],
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user