Skip to content

Commit

Permalink
add support for automatic package discovery (Laravel 5.5)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpocallaghan committed Sep 20, 2017
1 parent b4de36b commit e7404b9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Laravel 5 package to enable impersonation.
Debugging a problem and need to login as one of your customers? This allows you to authenticate as any of your customers.

<br/>See it in action at a [Laravel Admin Starter](https://github.com/bpocallaghan/laravel-admin-starter) project.
See it in action at a [Laravel Admin Starter](https://github.com/bpocallaghan/laravel-admin-starter) project.

## Installation

Expand All @@ -13,6 +13,7 @@ Update your project's `composer.json` file.
composer require bpocallaghan/impersonate --dev
```

`Laravel <5.4 only (Laravel 5.5 has automatic package discovery)`<br/>
Register the Service Provider in your `config/app` or in your `app/Providers/AppServiceProvider.php` to only allow it for development.

```php
Expand Down
9 changes: 8 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}
],
"require": {
"php": ">=5.6.4"
"php": ">=7.0.0"
},
"autoload": {
"psr-4": {
Expand All @@ -26,5 +26,12 @@
"files": [
"src/helpers.php"
]
},
"extra": {
"laravel": {
"providers": [
"Bpocallaghan\\Impersonate\\ImpersonateServiceProvider"
]
}
}
}
4 changes: 2 additions & 2 deletions src/ImpersonateServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public function boot()
*/
public function register()
{
$this->app->bind('impersonate', function () {
return $this->app->make('Bpocallaghan\Impersonate\Impersonate');
$this->app->singleton('impersonate', function () {
return $this->app->make(Impersonate::class);
});
}
}

0 comments on commit e7404b9

Please sign in to comment.