-
Notifications
You must be signed in to change notification settings - Fork 0
/
LaravelCardsServiceProvider.php
executable file
·77 lines (65 loc) · 2.73 KB
/
LaravelCardsServiceProvider.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
<?php
namespace DavideCasiraghi\LaravelCards;
use Carbon\Carbon;
use Illuminate\Support\ServiceProvider;
class LaravelCardsServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*/
public function boot()
{
/*
* Optional methods to load your package assets
*/
$this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'laravel-cards');
$this->loadViewsFrom(__DIR__.'/../resources/views', 'laravel-cards');
$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
$this->loadRoutesFrom(__DIR__.'/../routes/web.php');
$this->app['router']->aliasMiddleware('admin', \DavideCasiraghi\LaravelCards\Http\Middleware\Admin::class);
if (! class_exists('CreateCardsTable')) {
$this->publishes([
__DIR__.'/../database/migrations/create_cards_table.php.stub' => database_path('migrations/'.Carbon::now()->format('Y_m_d_Hmsu').'_create_cards_table.php'),
], 'migrations');
}
if (! class_exists('CreateCardTranslationsTable')) {
$this->publishes([
__DIR__.'/../database/migrations/create_card_translations_table.php.stub' => database_path('migrations/'.Carbon::now()->format('Y_m_d_Hmsu').'_create_card_translations_table.php'),
], 'migrations');
}
if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__.'/../config/config.php' => config_path('laravel-cards.php'),
], 'config');
$this->publishes([
__DIR__.'/../resources/assets/sass' => resource_path('sass/vendor/laravel-cards/'),
], 'sass');
// Publishing the views.
/*$this->publishes([
__DIR__.'/../resources/views' => resource_path('views/vendor/laravel-cards'),
], 'views');*/
// Publishing assets.
/*$this->publishes([
__DIR__.'/../resources/assets' => public_path('vendor/laravel-cards'),
], 'assets');*/
// Publishing the translation files.
$this->publishes([
__DIR__.'/../resources/lang' => resource_path('lang/vendor/laravel-cards'),
], 'lang');
// Registering package commands.
// $this->commands([]);
}
}
/**
* Register the application services.
*/
public function register()
{
// Automatically apply the package configuration
$this->mergeConfigFrom(__DIR__.'/../config/config.php', 'laravel-cards');
// Register the main class to use with the facade
$this->app->singleton('laravel-cards', function () {
return new LaravelCards;
});
}
}