-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy pathAppServiceProvider.php
54 lines (42 loc) · 1.41 KB
/
AppServiceProvider.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
namespace LaravelEnso\Tables;
use Illuminate\Support\Collection;
use Illuminate\Support\ServiceProvider;
use LaravelEnso\Tables\Commands\TemplateCacheClear;
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
$this->load()
->publish()
->commands(TemplateCacheClear::class);
}
private function load()
{
$this->mergeConfigFrom(__DIR__.'/../config/tables.php', 'enso.tables');
$this->mergeConfigFrom(__DIR__.'/../config/api.php', 'enso.tables');
$this->loadViewsFrom(__DIR__.'/../resources/views', 'laravel-enso/tables');
return $this;
}
private function publish()
{
$this->publishes([
__DIR__.'/../config/tables.php' => config_path('enso/tables.php'),
], ['tables-config', 'enso-config']);
$this->publishes([
__DIR__.'/../resources/views' => resource_path('views/vendor/laravel-enso/tables'),
], ['tables-mail', 'enso-mail']);
$this->stubs()->each(fn ($ext, $stub) => $this->publishes([
__DIR__."/../stubs/{$stub}.stub" => app_path("{$stub}.{$ext}"),
]));
return $this;
}
private function stubs()
{
return new Collection([
'Tables/Actions/CustomAction' => 'php',
'Tables/Builders/ModelTable' => 'php',
'Tables/Templates/template' => 'json',
]);
}
}