1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Devfaysal\LaravelAdmin; |
4
|
|
|
|
5
|
|
|
use Devfaysal\LaravelAdmin\Components\Text; |
6
|
|
|
use Devfaysal\LaravelAdmin\Models\Admin; |
7
|
|
|
use Illuminate\Support\Facades\Blade; |
8
|
|
|
use Illuminate\Support\Facades\Route; |
9
|
|
|
use Illuminate\Support\ServiceProvider; |
10
|
|
|
|
11
|
|
|
class LaravelAdminServiceProvider extends ServiceProvider |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* Bootstrap the application services. |
15
|
|
|
*/ |
16
|
|
|
public function boot() |
17
|
|
|
{ |
18
|
|
|
$this->configure(); |
19
|
|
|
/* |
20
|
|
|
* Optional methods to load your package assets |
21
|
|
|
*/ |
22
|
|
|
$this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'laravel-admin'); |
23
|
|
|
$this->loadViewsFrom(__DIR__.'/../resources/views', 'laravel-admin'); |
24
|
|
|
$this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
25
|
|
|
$this->loadRoutesFrom(__DIR__.'/routes.php'); |
26
|
|
|
$this->registerComponents(); |
27
|
|
|
|
28
|
|
|
if ($this->app->runningInConsole()) { |
29
|
|
|
$this->publishes([ |
30
|
|
|
__DIR__.'/../config/laravel-admin.php' => config_path('laravel-admin.php'), |
31
|
|
|
], 'config'); |
32
|
|
|
|
33
|
|
|
// $this->publishes([ |
34
|
|
|
// __DIR__.'/../database/migrations/' => database_path('migrations') |
35
|
|
|
// ], 'migrations'); |
36
|
|
|
|
37
|
|
|
// Publishing the views. |
38
|
|
|
$this->publishes([ |
39
|
|
|
__DIR__.'/../resources/views' => resource_path('views/vendor/laravel-admin'), |
40
|
|
|
], 'laravel-admin-views'); |
41
|
|
|
|
42
|
|
|
// Publishing assets. |
43
|
|
|
$this->publishes([ |
44
|
|
|
__DIR__.'/../public' => public_path('vendor/laravel-admin'), |
45
|
|
|
], 'laravel-admin-public'); |
46
|
|
|
// Publishing seeders. |
47
|
|
|
$this->publishes([ |
48
|
|
|
__DIR__.'/../database/seeders' => database_path('seeders'), |
49
|
|
|
], 'laravel-admin-seeders'); |
50
|
|
|
|
51
|
|
|
// Publishing the translation files. |
52
|
|
|
$this->publishes([ |
53
|
|
|
__DIR__.'/../resources/lang' => resource_path('lang/vendor/laravel-admin'), |
54
|
|
|
], 'laravel-admin-lang'); |
55
|
|
|
|
56
|
|
|
// Registering package commands. |
57
|
|
|
// $this->commands([]); |
58
|
|
|
|
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Register the application services. |
64
|
|
|
*/ |
65
|
|
|
public function register() |
66
|
|
|
{ |
67
|
|
|
// Automatically apply the package configuration |
68
|
|
|
$this->mergeConfigFrom(__DIR__.'/../config/laravel-admin.php', 'laravel-admin'); |
69
|
|
|
|
70
|
|
|
// Register the main class to use with the facade |
71
|
|
|
$this->app->singleton('laravel-admin', function () { |
72
|
|
|
return new LaravelAdmin; |
73
|
|
|
}); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
public function registerComponents() |
77
|
|
|
{ |
78
|
|
|
Blade::component('laravel-admin::components.tooltip', 'tooltip'); |
79
|
|
|
Blade::component('laravel-admin::components.form.textField', 'text-field'); |
80
|
|
|
Blade::component('laravel-admin::components.form.hiddenField', 'hidden-field'); |
81
|
|
|
Blade::component('laravel-admin::components.form.numberField', 'number-field'); |
82
|
|
|
Blade::component('laravel-admin::components.form.emailField', 'email-field'); |
83
|
|
|
Blade::component('laravel-admin::components.form.textareaField', 'textarea-field'); |
84
|
|
|
Blade::component('laravel-admin::components.form.passwordField', 'password-field'); |
85
|
|
|
Blade::component('laravel-admin::components.form.selectField', 'select-field'); |
86
|
|
|
Blade::component('laravel-admin::components.form.selectMultipleField', 'select-multiple-field'); |
87
|
|
|
Blade::component('laravel-admin::components.form.fileField', 'file-field'); |
88
|
|
|
Blade::component('laravel-admin::components.form.dateField', 'date-field'); |
89
|
|
|
Blade::component('laravel-admin::components.form.jQueryUidatePickerField', 'jqueryui-date-picker-field'); |
90
|
|
|
Blade::component('laravel-admin::components.form.checkboxField', 'checkbox-field'); |
91
|
|
|
Blade::component('laravel-admin::components.form.radioField', 'radio-field'); |
92
|
|
|
Blade::component('laravel-admin::components.form.checkboxMultiple', 'checkbox-multiple'); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
public function configure() |
96
|
|
|
{ |
97
|
|
|
$this->app->booted(function () { |
98
|
|
|
$this->app['config']->set('auth.guards.admin', [ |
99
|
|
|
'driver' => 'session', |
100
|
|
|
'provider' => 'admins', |
101
|
|
|
]); |
102
|
|
|
|
103
|
|
|
$this->app['config']->set('auth.passwords.admins', [ |
104
|
|
|
'provider' => 'admins', |
105
|
|
|
'table' => 'password_resets', |
106
|
|
|
'expire' => 60, |
107
|
|
|
'throttle' => 60, |
108
|
|
|
]); |
109
|
|
|
|
110
|
|
|
$this->app['config']->set('auth.providers.admins', [ |
111
|
|
|
'driver' => 'eloquent', |
112
|
|
|
'model' => Admin::class, |
113
|
|
|
]); |
114
|
|
|
}); |
115
|
|
|
} |
116
|
|
|
} |
117
|
|
|
|