Skip to content

Commit 4cdc9c3

Browse files
Fixed service provider
1 parent eb8d3cf commit 4cdc9c3

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

src/TinkerServiceProvider.php

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
namespace Laravel\Tinker;
44

5+
use Illuminate\Foundation\Application as LaravelApplication;
56
use Illuminate\Support\ServiceProvider;
7+
use Laravel\Lumen\Application as LumenApplication;
68
use Laravel\Tinker\Console\TinkerCommand;
79

810
class TinkerServiceProvider extends ServiceProvider
@@ -14,6 +16,22 @@ class TinkerServiceProvider extends ServiceProvider
1416
*/
1517
protected $defer = true;
1618

19+
/**
20+
* Boot the service provider.
21+
*
22+
* @return void
23+
*/
24+
public function boot()
25+
{
26+
$source = realpath($raw = __DIR__ . '/../config/tinker.php') ?: $raw;
27+
28+
if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) {
29+
$this->publishes([$source => config_path('tinker.php')]);
30+
} elseif ($this->app instanceof LumenApplication) {
31+
$this->app->configure('tinker');
32+
}
33+
}
34+
1735
/**
1836
* Register the service provider.
1937
*
@@ -25,10 +43,6 @@ public function register()
2543
return new TinkerCommand;
2644
});
2745

28-
$this->publishes([
29-
__DIR__ . '/../config/tinker.php.stub' => config_path('tinker.php'),
30-
], 'config');
31-
3246
$this->commands(['command.tinker']);
3347
}
3448

0 commit comments

Comments
 (0)