FrontMenuServiceProvider.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace Longyi\FrontMenu\Providers;
  3. use Illuminate\Support\Facades\Blade;
  4. use Illuminate\Support\ServiceProvider;
  5. class FrontMenuServiceProvider extends ServiceProvider
  6. {
  7. /**
  8. * Register services.
  9. */
  10. public function register(): void
  11. {
  12. // Merge the front menu admin item into the `menu.admin` config so it
  13. // appears under the existing "Settings" menu (key prefixed with "settings.").
  14. $this->mergeConfigFrom(__DIR__ . '/../Config/menu.php', 'menu.admin');
  15. // Register ACL permissions so the menu item is visible to admin users.
  16. $this->mergeConfigFrom(__DIR__ . '/../Config/acl.php', 'acl');
  17. }
  18. /**
  19. * Bootstrap services.
  20. */
  21. public function boot(): void
  22. {
  23. $this->loadRoutesFrom(__DIR__ . '/../Routes/admin-routes.php');
  24. $this->loadViewsFrom(__DIR__ . '/../Resources/views', 'frontmenu');
  25. $this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'frontmenu');
  26. $this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
  27. Blade::anonymousComponentPath(__DIR__ . '/../Resources/views/admin/menu/partials', 'frontmenu');
  28. $this->publishes([
  29. __DIR__ . '/../Resources/views' => resource_path('views/vendor/longyi/frontmenu'),
  30. ], 'frontmenu-views');
  31. $this->publishes([
  32. __DIR__ . '/../Database/Seeders' => database_path('seeders'),
  33. ], 'frontmenu-seeds');
  34. if ($this->app->runningInConsole()) {
  35. $this->commands([
  36. \Longyi\FrontMenu\Console\Commands\InitializeFrontMenu::class,
  37. ]);
  38. }
  39. }
  40. }