1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
namespace agoalofalife\Reports; |
5
|
|
|
|
6
|
|
|
use Illuminate\Support\Facades\Route; |
7
|
|
|
use Illuminate\Support\ServiceProvider; |
8
|
|
|
|
9
|
|
|
|
10
|
|
|
class ReportsServiceProvider extends ServiceProvider |
11
|
|
|
{ |
12
|
19 |
|
public function boot() |
13
|
|
|
{ |
14
|
19 |
|
$this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
15
|
19 |
|
$this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'reports'); |
16
|
19 |
|
$this->registerRoutes(); |
17
|
19 |
|
$this->registerCommands(); |
18
|
19 |
|
$this->loadViews(); |
19
|
19 |
|
$this->mergeConfigFrom(__DIR__.'/../config/reports.php', 'reports'); |
20
|
19 |
|
$this->toPublish(); |
21
|
19 |
|
} |
22
|
|
|
|
23
|
19 |
|
public function register() |
24
|
|
|
{ |
25
|
19 |
|
if (! defined('REPORTS_PATH')) { |
26
|
1 |
|
define('REPORTS_PATH', realpath(__DIR__.'/../')); |
27
|
|
|
} |
28
|
19 |
|
} |
29
|
|
|
|
30
|
19 |
|
protected function toPublish() |
31
|
|
|
{ |
32
|
|
|
// $this->publishes([ |
33
|
|
|
// __DIR__.'/../database/migrations' => database_path('migrations'), |
34
|
|
|
// ], 'reports-migration'); |
35
|
19 |
|
$this->publishes([ |
36
|
19 |
|
__DIR__.'/../config/reports.php' => config_path('reports.php'), |
37
|
19 |
|
], 'reports-migration'); |
38
|
19 |
|
$this->publishes([ |
39
|
19 |
|
__DIR__.'/../resources/lang' => resource_path('lang/vendor/reports'), |
40
|
19 |
|
], 'reports-migration'); |
41
|
19 |
|
$this->publishes([ |
42
|
19 |
|
REPORTS_PATH.'/public' => public_path('vendor/reports'), |
43
|
19 |
|
], 'reports-assets'); |
44
|
|
|
|
45
|
19 |
|
$this->publishes([ |
46
|
19 |
|
__DIR__.'/../resources/assets/js/components' => base_path('resources/assets/js/components/reports'), |
47
|
19 |
|
], 'reports-components'); |
48
|
19 |
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Register commands |
52
|
|
|
*/ |
53
|
19 |
|
protected function registerCommands() : void |
54
|
|
|
{ |
55
|
19 |
|
$this->commands([ |
56
|
19 |
|
Console\InstallCommand::class, |
57
|
|
|
Console\AssetsConsole::class, |
58
|
|
|
Console\ReportMakeCommand::class, |
59
|
|
|
Console\HandleReportCommand::class, |
60
|
|
|
Console\ParseReportsCommand::class, |
61
|
|
|
]); |
62
|
19 |
|
} |
63
|
|
|
|
64
|
19 |
|
protected function registerRoutes() : void |
65
|
|
|
{ |
66
|
19 |
|
Route::group([ |
67
|
19 |
|
'prefix' => 'reports', |
68
|
|
|
'namespace' => 'agoalofalife\Reports\Http\Controllers', |
69
|
|
|
'middleware' => 'web', |
70
|
19 |
|
], function () { |
71
|
19 |
|
$this->loadRoutesFrom(__DIR__.'/../routes/web.php'); |
72
|
19 |
|
}); |
73
|
19 |
|
} |
74
|
19 |
|
protected function loadViews() : void |
75
|
|
|
{ |
76
|
19 |
|
$this->loadViewsFrom(__DIR__.'/../resources/views', 'reports'); |
77
|
|
|
} |
78
|
|
|
} |