|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace DavideCasiraghi\LaravelColumns; |
|
4
|
|
|
|
|
5
|
|
|
use Carbon\Carbon; |
|
6
|
|
|
use Illuminate\Support\ServiceProvider; |
|
7
|
|
|
|
|
8
|
|
|
class LaravelColumnsServiceProvider extends ServiceProvider |
|
9
|
|
|
{ |
|
10
|
|
|
/** |
|
11
|
|
|
* Bootstrap the application services. |
|
12
|
|
|
*/ |
|
13
|
39 |
|
public function boot() |
|
14
|
|
|
{ |
|
15
|
|
|
/* |
|
16
|
|
|
* Optional methods to load your package assets |
|
17
|
|
|
*/ |
|
18
|
39 |
|
$this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'laravel-columns'); |
|
19
|
39 |
|
$this->loadViewsFrom(__DIR__.'/../resources/views', 'laravel-columns'); |
|
20
|
39 |
|
$this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
|
21
|
39 |
|
$this->loadRoutesFrom(__DIR__.'/../routes/web.php'); |
|
22
|
|
|
|
|
23
|
39 |
|
if (! class_exists('CreateColumnsTable')) { |
|
24
|
1 |
|
$this->publishes([ |
|
25
|
1 |
|
__DIR__.'/../database/migrations/create_columns_table.php.stub' => database_path('migrations/'.Carbon::now()->format('Y_m_d_Hmsu').'_create_columns_table.php'), |
|
26
|
1 |
|
], 'migrations'); |
|
27
|
|
|
} |
|
28
|
39 |
|
if (! class_exists('CreateColumnTranslationsTable')) { |
|
29
|
1 |
|
$this->publishes([ |
|
30
|
1 |
|
__DIR__.'/../database/migrations/create_column_translations_table.php.stub' => database_path('migrations/'.Carbon::now()->format('Y_m_d_Hmsu').'_create_column_translations_table.php'), |
|
31
|
1 |
|
], 'migrations'); |
|
32
|
|
|
} |
|
33
|
39 |
|
if (! class_exists('CreateColumnGroupsTable')) { |
|
34
|
1 |
|
$this->publishes([ |
|
35
|
1 |
|
__DIR__.'/../database/migrations/create_column_groups_table.php.stub' => database_path('migrations/'.Carbon::now()->format('Y_m_d_Hmsu').'_create_column_groups_table.php'), |
|
36
|
1 |
|
], 'migrations'); |
|
37
|
|
|
} |
|
38
|
39 |
|
if (! class_exists('CreateColumnGroupTranslationsTable')) { |
|
39
|
1 |
|
$this->publishes([ |
|
40
|
1 |
|
__DIR__.'/../database/migrations/create_column_group_translations_table.php.stub' => database_path('migrations/'.Carbon::now()->format('Y_m_d_Hmsu').'_create_column_group_translations_table.php'), |
|
41
|
1 |
|
], 'migrations'); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
39 |
|
if ($this->app->runningInConsole()) { |
|
45
|
39 |
|
$this->publishes([ |
|
46
|
39 |
|
__DIR__.'/../config/config.php' => config_path('laravel-columns.php'), |
|
47
|
39 |
|
], 'config'); |
|
48
|
|
|
|
|
49
|
|
|
// Publishing the views. |
|
50
|
39 |
|
$this->publishes([ |
|
51
|
39 |
|
__DIR__.'/../resources/views' => resource_path('views/vendor/laravel-columns'), |
|
52
|
39 |
|
], 'views'); |
|
53
|
|
|
|
|
54
|
39 |
|
$this->publishes([ |
|
55
|
39 |
|
__DIR__.'/../resources/assets/sass' => resource_path('sass/vendor/laravel-columns/'), |
|
56
|
39 |
|
], 'sass'); |
|
57
|
|
|
|
|
58
|
|
|
// Publishing assets. |
|
59
|
|
|
/*$this->publishes([ |
|
60
|
|
|
__DIR__.'/../resources/assets' => public_path('vendor/laravel-columns'), |
|
61
|
|
|
], 'assets');*/ |
|
62
|
|
|
|
|
63
|
|
|
// Publishing the translation files. |
|
64
|
39 |
|
$this->publishes([ |
|
65
|
39 |
|
__DIR__.'/../resources/lang' => resource_path('lang/vendor/laravel-columns'), |
|
66
|
39 |
|
], 'lang'); |
|
67
|
|
|
|
|
68
|
|
|
// Registering package commands. |
|
69
|
|
|
// $this->commands([]); |
|
70
|
|
|
} |
|
71
|
39 |
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* Register the application services. |
|
75
|
|
|
*/ |
|
76
|
39 |
|
public function register() |
|
77
|
|
|
{ |
|
78
|
|
|
// Automatically apply the package configuration |
|
79
|
39 |
|
$this->mergeConfigFrom(__DIR__.'/../config/config.php', 'laravel-columns'); |
|
80
|
|
|
|
|
81
|
|
|
// Register the main class to use with the facade |
|
82
|
|
|
$this->app->singleton('laravel-columns', function () { |
|
83
|
7 |
|
return new LaravelColumns; |
|
84
|
39 |
|
}); |
|
85
|
39 |
|
} |
|
86
|
|
|
} |
|
87
|
|
|
|