|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Aminetiyal\LaravelTemplate; |
|
4
|
|
|
|
|
5
|
|
|
use Aminetiyal\LaravelTemplate\Commands\TemplateInstall; |
|
6
|
|
|
use Aminetiyal\LaravelTemplate\Components\Lte\Breadcrumb; |
|
7
|
|
|
use Aminetiyal\LaravelTemplate\Components\Lte\Field\Checkbox; |
|
8
|
|
|
use Aminetiyal\LaravelTemplate\Components\Lte\Field\Input; |
|
9
|
|
|
use Aminetiyal\LaravelTemplate\Components\Lte\Field\Password; |
|
10
|
|
|
use Aminetiyal\LaravelTemplate\Components\Lte\Field\Textarea; |
|
11
|
|
|
use Aminetiyal\LaravelTemplate\Components\Lte\Footer; |
|
12
|
|
|
use Aminetiyal\LaravelTemplate\Components\Lte\MenuItem; |
|
13
|
|
|
use Aminetiyal\LaravelTemplate\Components\Lte\Navbar; |
|
14
|
|
|
use Aminetiyal\LaravelTemplate\Components\Lte\Scripts; |
|
15
|
|
|
use Aminetiyal\LaravelTemplate\Components\Lte\Sidebar; |
|
16
|
|
|
use Aminetiyal\LaravelTemplate\Components\Lte\Styles; |
|
17
|
|
|
use Illuminate\Support\ServiceProvider; |
|
18
|
|
|
|
|
19
|
|
|
class LaravelTemplateServiceProvider extends ServiceProvider |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* Bootstrap the application services. |
|
23
|
|
|
*/ |
|
24
|
|
|
public function boot() |
|
25
|
|
|
{ |
|
26
|
|
|
$this->loadViewsFrom(__DIR__ . '/../resources/views', 'template'); |
|
27
|
|
|
|
|
28
|
|
|
$this->loadTranslationsFrom(__DIR__ . '/../resources/lang', 'template'); |
|
29
|
|
|
|
|
30
|
|
|
$this->bootAdminLte(); |
|
31
|
|
|
|
|
32
|
|
|
// $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
|
33
|
|
|
// $this->loadRoutesFrom(__DIR__.'/routes.php'); |
|
34
|
|
|
|
|
35
|
|
|
if ($this->app->runningInConsole()) { |
|
36
|
|
|
// config |
|
37
|
|
|
$this->publishes([ |
|
38
|
|
|
__DIR__ . '/../config/config.php' => config_path('template.php'), |
|
39
|
|
|
], 'template-config'); |
|
40
|
|
|
|
|
41
|
|
|
|
|
42
|
|
|
// Publishing the translation files. |
|
43
|
|
|
$this->publishes([ |
|
44
|
|
|
__DIR__ . '/../resources/lang' => resource_path('lang/vendor/template/'), |
|
45
|
|
|
], 'template-lang'); |
|
46
|
|
|
|
|
47
|
|
|
// Publishing profile controller & view. |
|
48
|
|
|
$this->publishes( |
|
49
|
|
|
[__DIR__ . '/../src/Http/Controllers/Auth/ProfileController.php' => app_path('Http/Controllers/Auth/ProfileController.php')] |
|
50
|
|
|
, 'template-profile-controller'); |
|
51
|
|
|
|
|
52
|
|
|
// Publishing assets. |
|
53
|
|
|
/*$this->publishes([ |
|
54
|
|
|
__DIR__.'/../resources/assets' => public_path('vendor/laravel-template'), |
|
55
|
|
|
], 'assets');*/ |
|
56
|
|
|
|
|
57
|
|
|
|
|
58
|
|
|
// Registering package commands. |
|
59
|
|
|
$this->commands([ |
|
60
|
|
|
TemplateInstall::class, |
|
61
|
|
|
]); |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
public function bootAdminLte() |
|
66
|
|
|
{ |
|
67
|
|
|
$this->loadAdminLteComponents(); |
|
68
|
|
|
|
|
69
|
|
|
if ($this->app->runningInConsole()) { |
|
70
|
|
|
// Publishing the views. |
|
71
|
|
|
$this->publishes([ |
|
72
|
|
|
__DIR__ . '/../resources/views/lte' => resource_path('views/vendor/template/lte'), |
|
73
|
|
|
], 'template-adminlte-views'); |
|
74
|
|
|
|
|
75
|
|
|
// Publishing assets. |
|
76
|
|
|
$this->publishes([ |
|
77
|
|
|
__DIR__ . '/../resources/assets/lte' => public_path('vendor/laravel-template/lte'), |
|
78
|
|
|
], 'template-adminlte-assets'); |
|
79
|
|
|
} |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
public function loadAdminLteComponents() |
|
83
|
|
|
{ |
|
84
|
|
|
// Loading layouts |
|
85
|
|
|
$this->loadViewComponentsAs('lte', [ |
|
86
|
|
|
Sidebar::class, |
|
87
|
|
|
Navbar::class, |
|
88
|
|
|
Styles::class, |
|
89
|
|
|
Scripts::class, |
|
90
|
|
|
Footer::class, |
|
91
|
|
|
MenuItem::class, |
|
92
|
|
|
Breadcrumb::class, |
|
93
|
|
|
]); |
|
94
|
|
|
|
|
95
|
|
|
// Loading fields |
|
96
|
|
|
$this->loadViewComponentsAs('lte-field', [ |
|
97
|
|
|
Input::class, |
|
98
|
|
|
Password::class, |
|
99
|
|
|
Checkbox::class, |
|
100
|
|
|
Textarea::class |
|
101
|
|
|
]); |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* Register the application services. |
|
106
|
|
|
*/ |
|
107
|
|
|
public function register() |
|
108
|
|
|
{ |
|
109
|
|
|
// Automatically apply the package configuration |
|
110
|
|
|
$this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'template'); |
|
111
|
|
|
|
|
112
|
|
|
// Register the main class to use with the facade |
|
113
|
|
|
$this->app->singleton('template', function () { |
|
114
|
|
|
return new LaravelTemplate; |
|
115
|
|
|
}); |
|
116
|
|
|
} |
|
117
|
|
|
} |
|
118
|
|
|
|