Skip to content
This repository was archived by the owner on Oct 21, 2019. It is now read-only.

Commit dec09d7

Browse files
committed
Prevent package from being loaded in production
1 parent 6b7698f commit dec09d7

File tree

1 file changed

+26
-35
lines changed

1 file changed

+26
-35
lines changed

src/Providers/Service.php

Lines changed: 26 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,33 @@
55

66
class Service extends ServiceProvider
77
{
8-
protected $defer = false;
9-
108
public function boot()
119
{
12-
$this->publishes([
13-
__DIR__ . '/../../config/genealabs-laravel-whoops-atom.php'
14-
=> config_path('genealabs-laravel-whoops-atom.php')
15-
], 'config');
16-
17-
config([
18-
'app.editor' => function ($file, $line) {
19-
$homestead = rtrim(config('genealabs-laravel-whoops-atom.homestead-sites-path'), '/');
20-
$local = rtrim(config('genealabs-laravel-whoops-atom.local-sites-path'), '/');
21-
22-
if (! $local) {
23-
return '';
24-
}
25-
26-
$file = str_replace("{$homestead}/", "{$local}/", $file);
27-
28-
return "atom://open?url=file://{$file}&line={$line}";
29-
},
30-
]);
31-
}
32-
33-
public function register()
34-
{
35-
$this->commands(Publish::class);
36-
$this->mergeConfigFrom(
37-
__DIR__ . '/../../config/genealabs-laravel-whoops-atom.php',
38-
'genealabs-laravel-whoops-atom'
39-
);
40-
}
41-
42-
public function provides() : array
43-
{
44-
return ['genealabs-laravel-whoops-atom'];
10+
if (config('app.env') !== 'production') {
11+
$this->publishes([
12+
__DIR__ . '/../../config/genealabs-laravel-whoops-atom.php'
13+
=> config_path('genealabs-laravel-whoops-atom.php')
14+
], 'config');
15+
16+
config([
17+
'app.editor' => function ($file, $line) {
18+
$homestead = rtrim(config('genealabs-laravel-whoops-atom.homestead-sites-path'), '/');
19+
$local = rtrim(config('genealabs-laravel-whoops-atom.local-sites-path'), '/');
20+
21+
if (! $local) {
22+
return '';
23+
}
24+
25+
$file = str_replace("{$homestead}/", "{$local}/", $file);
26+
27+
return "atom://open?url=file://{$file}&line={$line}";
28+
},
29+
]);
30+
$this->commands(Publish::class);
31+
$this->mergeConfigFrom(
32+
__DIR__ . '/../../config/genealabs-laravel-whoops-atom.php',
33+
'genealabs-laravel-whoops-atom'
34+
);
35+
}
4536
}
4637
}

0 commit comments

Comments
 (0)