Skip to content
This repository was archived by the owner on Aug 28, 2021. It is now read-only.

Commit ad9c74f

Browse files
author
Ben Speakman
committed
Use singleton method for Laravel 5.2
1 parent d2c2c05 commit ad9c74f

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
],
1212
"require": {
1313
"php": ">=5.5.0",
14-
"illuminate/support": "~5.0",
14+
"illuminate/support": "~5.2",
1515
"guzzlehttp/guzzle": "~6.0"
1616
},
1717
"require-dev": {
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?php namespace Threesquared\LaravelWpApi\Facades;
22

33
use Illuminate\Support\Facades\Facade;
4+
use Threesquared\LaravelWpApi\WpApi;
45

56
class WpApi extends Facade {
67

7-
protected static function getFacadeAccessor() { return 'wp-api'; }
8+
protected static function getFacadeAccessor() { return WpApi::class; }
89

910
}

src/Threesquared/LaravelWpApi/LaravelWpApiServiceProvider.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function boot()
3131
*/
3232
public function register()
3333
{
34-
$this->app->bindShared('wp-api', function ($app) {
34+
$this->app->singleton(WpApi::class, function ($app) {
3535

3636
$endpoint = $this->app['config']->get('wp-api.endpoint');
3737
$auth = $this->app['config']->get('wp-api.auth');
@@ -40,10 +40,6 @@ public function register()
4040
return new WpApi($endpoint, $client, $auth);
4141

4242
});
43-
44-
$this->app->bind('Threesquared\LaravelWpApi\WpApi', function ($app) {
45-
return $app['wp-api'];
46-
});
4743
}
4844

4945
/**

0 commit comments

Comments
 (0)