Use singleton method for Laravel 5.2
This commit is contained in:
parent
d2c2c0599c
commit
ad9c74f218
|
|
@ -11,7 +11,7 @@
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.5.0",
|
"php": ">=5.5.0",
|
||||||
"illuminate/support": "~5.0",
|
"illuminate/support": "~5.2",
|
||||||
"guzzlehttp/guzzle": "~6.0"
|
"guzzlehttp/guzzle": "~6.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
<?php namespace Threesquared\LaravelWpApi\Facades;
|
<?php namespace Threesquared\LaravelWpApi\Facades;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Facade;
|
use Illuminate\Support\Facades\Facade;
|
||||||
|
use Threesquared\LaravelWpApi\WpApi;
|
||||||
|
|
||||||
class WpApi extends Facade {
|
class WpApi extends Facade {
|
||||||
|
|
||||||
protected static function getFacadeAccessor() { return 'wp-api'; }
|
protected static function getFacadeAccessor() { return WpApi::class; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class LaravelWpApiServiceProvider extends ServiceProvider
|
||||||
*/
|
*/
|
||||||
public function register()
|
public function register()
|
||||||
{
|
{
|
||||||
$this->app->bindShared('wp-api', function ($app) {
|
$this->app->singleton(WpApi::class, function ($app) {
|
||||||
|
|
||||||
$endpoint = $this->app['config']->get('wp-api.endpoint');
|
$endpoint = $this->app['config']->get('wp-api.endpoint');
|
||||||
$auth = $this->app['config']->get('wp-api.auth');
|
$auth = $this->app['config']->get('wp-api.auth');
|
||||||
|
|
@ -40,10 +40,6 @@ class LaravelWpApiServiceProvider extends ServiceProvider
|
||||||
return new WpApi($endpoint, $client, $auth);
|
return new WpApi($endpoint, $client, $auth);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->app->bind('Threesquared\LaravelWpApi\WpApi', function ($app) {
|
|
||||||
return $app['wp-api'];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue