1 | <?php |
||
17 | class BackProjectServiceProvider extends ServiceProvider |
||
18 | { |
||
19 | |||
20 | protected $defer = false; |
||
21 | |||
22 | protected $migrations = [ |
||
23 | 'ModifyUsersTable' => 'modify_users_table', |
||
24 | 'CreateMenusTable' => 'create_menus_table', |
||
25 | 'CreateAttachmentsTable' => 'create_attachments_table', |
||
26 | 'CreateSocialAccountsTable' => 'create_social_accounts_table', |
||
27 | 'UsersAddSocial' => 'users_add_social' |
||
28 | ]; |
||
29 | |||
30 | protected $helpers = [ |
||
31 | 'icons' |
||
32 | ]; |
||
33 | |||
34 | public function boot() |
||
35 | { |
||
36 | // LOAD THE VIEWS |
||
37 | // - first the published views (in case they have any changes) |
||
38 | $this->loadViewsFrom(resource_path('views/vendor/back-project/base'), 'back-project'); |
||
39 | // - then the stock views that come with the package, in case a published view might be missing |
||
40 | $this->loadViewsFrom(__DIR__ . '/../resources/views', 'back-project'); |
||
41 | // Load Translations |
||
42 | $this->loadTranslationsFrom(__DIR__ . '/../resources/lang', 'back-project'); |
||
43 | |||
44 | // use the vendor configuration file as fallback |
||
45 | $this->mergeConfigFrom( |
||
46 | __DIR__ . '/../config/config.php', 'back-project' |
||
47 | ); |
||
48 | |||
49 | $this->routes(); |
||
50 | |||
51 | $this->publishFiles(); |
||
52 | |||
53 | //$this->handleMigrations(); |
||
|
|||
54 | $this->loadMigrationsFrom(realpath(__DIR__.'/../database/migrations')); |
||
55 | |||
56 | $this->registerEvents(); |
||
57 | |||
58 | $this->registerCommands(); |
||
59 | |||
60 | $this->registerViewComposers(); |
||
61 | } |
||
62 | |||
63 | public function register() |
||
64 | { |
||
65 | $this->app->singleton('media-manager', function ($app) { |
||
66 | return new MediaManager(); |
||
67 | }); |
||
68 | |||
69 | // TODO |
||
70 | /*$this->app->singleton('back-project', function ($app) { |
||
71 | return new BackProject(); |
||
72 | }); |
||
73 | |||
74 | $this->app->singleton('slug-generator', function ($app) { |
||
75 | return new SlugGenerator(); |
||
76 | });*/ |
||
77 | |||
78 | // register dependencies |
||
79 | $this->app->register(\Prologue\Alerts\AlertsServiceProvider::class); |
||
80 | $this->app->register(\Spatie\Permission\PermissionServiceProvider::class); |
||
81 | $this->app->register(\PendoNL\LaravelFontAwesome\LaravelFontAwesomeServiceProvider::class); |
||
82 | $this->app->register(\Collective\Html\HtmlServiceProvider::class); |
||
83 | $this->app->register(\Laravolt\Avatar\ServiceProvider::class); |
||
84 | $this->app->register(\Intervention\Image\ImageServiceProvider::class); |
||
85 | $this->app->register(\Laravel\Socialite\SocialiteServiceProvider::class); |
||
86 | |||
87 | // register their aliases |
||
88 | $loader = \Illuminate\Foundation\AliasLoader::getInstance(); |
||
89 | $loader->alias('Alert', \Prologue\Alerts\Facades\Alert::class); |
||
90 | $loader->alias('FontAwesome', \PendoNL\LaravelFontAwesome\Facade::class); |
||
91 | $loader->alias('Form', \Collective\Html\FormFacade::class); |
||
92 | $loader->alias('Html', \Collective\Html\HtmlFacade::class); |
||
93 | $loader->alias('Avatar', \Laravolt\Avatar\Facade::class); |
||
94 | $loader->alias('MediaManager', \Afrittella\BackProject\Facades\MediaManager::class); |
||
95 | $loader->alias('SlugGenerator', \Afrittella\BackProject\Facades\SlugGenerator::class); |
||
96 | $loader->alias('Image', \Intervention\Image\Facades\Image::class); |
||
97 | $loader->alias('Socialite', \Laravel\Socialite\Facades\Socialite::class); |
||
98 | |||
99 | $this->loadHelpers(); |
||
100 | |||
101 | } |
||
102 | |||
103 | /*** Internal function ***/ |
||
104 | |||
105 | public function publishFiles() |
||
122 | |||
123 | public function routes() |
||
124 | { |
||
125 | // Register Middleware |
||
126 | $router = app('router'); |
||
127 | |||
128 | //$router->aliasMiddleware('admin', \Afrittella\BackProject\Http\Middleware\Admin::class); |
||
129 | //$router->aliasMiddleware('role', \Afrittella\BackProject\Http\Middleware\Role::class); |
||
130 | |||
131 | $this->loadRoutesFrom(__DIR__ . '/../routes/web.php'); |
||
132 | } |
||
133 | |||
134 | public function handleMigrations() |
||
147 | |||
148 | public function registerEvents() |
||
162 | |||
163 | public function registerCommands() |
||
172 | |||
173 | public function registerViewComposers() |
||
178 | |||
179 | public function loadHelpers() |
||
189 | |||
190 | } |
||
191 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.