Use singleton method for Laravel 5.2

This commit is contained in:
Ben Speakman 2016-03-16 17:21:59 +00:00
parent d2c2c0599c
commit ad9c74f218
3 changed files with 4 additions and 7 deletions

View file

@ -11,7 +11,7 @@
],
"require": {
"php": ">=5.5.0",
"illuminate/support": "~5.0",
"illuminate/support": "~5.2",
"guzzlehttp/guzzle": "~6.0"
},
"require-dev": {

View file

@ -1,9 +1,10 @@
<?php namespace Threesquared\LaravelWpApi\Facades;
use Illuminate\Support\Facades\Facade;
use Threesquared\LaravelWpApi\WpApi;
class WpApi extends Facade {
protected static function getFacadeAccessor() { return 'wp-api'; }
protected static function getFacadeAccessor() { return WpApi::class; }
}

View file

@ -31,7 +31,7 @@ class LaravelWpApiServiceProvider extends ServiceProvider
*/
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');
$auth = $this->app['config']->get('wp-api.auth');
@ -40,10 +40,6 @@ class LaravelWpApiServiceProvider extends ServiceProvider
return new WpApi($endpoint, $client, $auth);
});
$this->app->bind('Threesquared\LaravelWpApi\WpApi', function ($app) {
return $app['wp-api'];
});
}
/**