-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathLaravelApiModuleGeneratorServiceProvider.php
86 lines (73 loc) · 2.47 KB
/
LaravelApiModuleGeneratorServiceProvider.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
namespace TimeHunter\LaravelApiModuleGenerator;
use Illuminate\Support\ServiceProvider;
use TimeHunter\LaravelApiModuleGenerator\Commands\LaravelApiModuleCommand;
class LaravelApiModuleGeneratorServiceProvider extends ServiceProvider
{
/**
* Perform post-registration booting of services.
*
* @return void
*/
public function boot()
{
// $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'timehunter');
// $this->loadViewsFrom(__DIR__.'/../resources/views', 'timehunter');
// $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
// $this->loadRoutesFrom(__DIR__.'/routes.php');
// Publishing is only necessary when using the CLI.
if ($this->app->runningInConsole()) {
$this->bootForConsole();
}
}
/**
* Register any package services.
*
* @return void
*/
public function register()
{
$this->mergeConfigFrom(__DIR__.'/../config/laravelapimodulegenerator.php', 'laravelapimodulegenerator');
// Register the service the package provides.
$this->app->singleton('laravelapimodulegenerator', function ($app) {
return new LaravelApiModuleGenerator;
});
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return ['laravelapimodulegenerator'];
}
/**
* Console-specific booting.
*
* @return void
*/
protected function bootForConsole()
{
// Publishing the configuration file.
$this->publishes([
__DIR__.'/../config/laravelapimodulegenerator.php' => config_path('laravelapimodulegenerator.php'),
], 'laravelapimodulegenerator');
// Publishing the views.
/*$this->publishes([
__DIR__.'/../resources/views' => base_path('resources/views/vendor/timehunter'),
], 'laravelapimodulegenerator.views');*/
// Publishing assets.
/*$this->publishes([
__DIR__.'/../resources/assets' => public_path('vendor/timehunter'),
], 'laravelapimodulegenerator.views');*/
// Publishing the translation files.
/*$this->publishes([
__DIR__.'/../resources/lang' => resource_path('lang/vendor/timehunter'),
], 'laravelapimodulegenerator.views');*/
// Registering package commands.
$this->commands([
LaravelApiModuleCommand::class
]);
}
}