-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathToonServiceProvider.php
More file actions
47 lines (40 loc) · 1.1 KB
/
Copy pathToonServiceProvider.php
File metadata and controls
47 lines (40 loc) · 1.1 KB
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
<?php
namespace RobertGDev\LaravelToon;
use Illuminate\Support\ServiceProvider;
use RobertGDev\LaravelToon\Console\ToonCommand;
class ToonServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
// Merge default config
$this->mergeConfigFrom(
__DIR__.'/../config/toon.php',
'toon'
);
// Register the Laravel Toon wrapper as a singleton
$this->app->singleton('toon', function ($app) {
return new Toon();
});
// Register the facade alias
$this->app->alias('toon', Toon::class);
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
if ($this->app->runningInConsole()) {
// Register commands
$this->commands([
ToonCommand::class,
]);
// Publish config file
$this->publishes([
__DIR__.'/../config/toon.php' => config_path('toon.php'),
], 'toon-config');
}
}
}