-
Notifications
You must be signed in to change notification settings - Fork 1
/
ServiceProvider.php
46 lines (43 loc) · 1.44 KB
/
ServiceProvider.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
<?php
namespace LaravelReady\Packager;
use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
use LaravelReady\Packager\Services\PackagerService;
use LaravelReady\Packager\Console\Commands\NewCommand;
use LaravelReady\Packager\Console\Commands\ListPackagesCommand;
use LaravelReady\Packager\Console\Commands\MakeCommand;
use LaravelReady\Packager\Console\Commands\TouchCommand;
use LaravelReady\Packager\Console\Commands\TessssCommand;
final class PackagerServiceProvider extends BaseServiceProvider
{
public function boot(Router $router) : void
{
$this->bootPublishes();
$this->loadCommands();
}
public function register() : void
{
$this->mergeConfigFrom(__DIR__ . '/../config/packager.php', 'packager');
// register package service
$this->app->singleton('packager', function () {
return new PackagerService();
});
}
/**
* Boot publishes
*/
private function bootPublishes() : void
{
// package configs
$this->publishes(paths: [__DIR__ . '/../config/packager.php' => $this->app->configPath('packager.php')], groups: 'packager-config');
}
/**
* Load package commands
*/
private function loadCommands()
{
if ($this->app->runningInConsole()) {
$this->commands([NewCommand::class, MakeCommand::class, ListPackagesCommand::class, TouchCommand::class]);
}
}
}