1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Retosteffen\LaravelBlog; |
4
|
|
|
|
5
|
|
|
use Illuminate\Support\ServiceProvider; |
6
|
|
|
|
7
|
|
|
class LaravelBlogServiceProvider extends ServiceProvider |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* Bootstrap the application services. |
11
|
|
|
*/ |
12
|
|
|
public function boot() |
13
|
|
|
{ |
14
|
|
|
/* |
15
|
|
|
* Optional methods to load your package assets |
16
|
|
|
*/ |
17
|
|
|
$this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'laravel-blog'); |
18
|
|
|
$this->loadViewsFrom(__DIR__.'/../resources/views', 'laravel-blog'); |
19
|
|
|
$this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
20
|
|
|
$this->loadRoutesFrom(__DIR__.'/routes.php'); |
21
|
|
|
|
22
|
|
|
if ($this->app->runningInConsole()) { |
23
|
|
|
$this->publishes([ |
24
|
|
|
__DIR__.'/../config/config.php' => config_path('laravel-blog.php'), |
25
|
|
|
], 'laravel-blog:config'); |
26
|
|
|
|
27
|
|
|
// Publishing the views. |
28
|
|
|
$this->publishes([ |
29
|
|
|
__DIR__.'/../resources/views' => resource_path('views/vendor/laravel-blog'), |
30
|
|
|
], 'laravel-blog:views'); |
31
|
|
|
|
32
|
|
|
if (! class_exists('CreateBlogsTable')) { |
33
|
|
|
$this->publishes([ |
34
|
|
|
__DIR__.'/../database/migrations/create_blogs_table.php.stub' => database_path('migrations/'.date('Y_m_d_His', time()).'_create_blogs_table.php'), |
35
|
|
|
], 'laravel-blog:migrations'); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
// Publishing assets. |
39
|
|
|
/*$this->publishes([ |
40
|
|
|
__DIR__.'/../resources/assets' => public_path('vendor/laravel-blog'), |
41
|
|
|
], 'assets');*/ |
42
|
|
|
|
43
|
|
|
// Publishing the translation files. |
44
|
|
|
$this->publishes([ |
45
|
|
|
__DIR__.'/../resources/lang' => resource_path('lang/vendor/laravel-blog'), |
46
|
|
|
], 'laravel-blog:lang'); |
47
|
|
|
|
48
|
|
|
// Registering package commands. |
49
|
|
|
// $this->commands([]); |
50
|
|
|
} |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Register the application services. |
55
|
|
|
*/ |
56
|
|
|
public function register() |
57
|
|
|
{ |
58
|
|
|
// Automatically apply the package configuration |
59
|
|
|
$this->mergeConfigFrom(__DIR__.'/../config/config.php', 'laravel-blog'); |
60
|
|
|
|
61
|
|
|
// Register the main class to use with the facade |
62
|
|
|
$this->app->singleton('laravel-blog', function () { |
63
|
|
|
return new LaravelBlog; |
64
|
|
|
}); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|