From 27af33597c709c2b55517c33098af16e7aac558d Mon Sep 17 00:00:00 2001 From: Dedan Date: Tue, 3 Sep 2024 17:59:19 +0300 Subject: [PATCH] Release 2024.4 --- app/Filament/Clusters/Sale.php | 29 ++++++ app/Filament/SalePlugin.php | 27 ++++++ app/Providers/EventServiceProvider.php | 32 +++++++ app/Providers/RouteServiceProvider.php | 49 ++++++++++ app/Providers/SaleServiceProvider.php | 120 +++++++++++++++++++++++++ composer.json | 4 +- config/.gitkeep | 0 config/config.php | 5 ++ routes/.gitkeep | 0 routes/api.php | 12 +++ routes/web.php | 12 +++ 11 files changed, 288 insertions(+), 2 deletions(-) create mode 100644 app/Filament/Clusters/Sale.php create mode 100644 app/Filament/SalePlugin.php create mode 100644 app/Providers/EventServiceProvider.php create mode 100644 app/Providers/RouteServiceProvider.php create mode 100644 app/Providers/SaleServiceProvider.php create mode 100644 config/.gitkeep create mode 100644 config/config.php create mode 100755 routes/.gitkeep create mode 100755 routes/api.php create mode 100755 routes/web.php diff --git a/app/Filament/Clusters/Sale.php b/app/Filament/Clusters/Sale.php new file mode 100644 index 0000000..50231f7 --- /dev/null +++ b/app/Filament/Clusters/Sale.php @@ -0,0 +1,29 @@ +> + */ + protected $listen = []; + + /** + * Indicates if events should be discovered. + * + * @var bool + */ + protected static $shouldDiscoverEvents = true; + + /** + * Configure the proper event listeners for email verification. + * + * @return void + */ + protected function configureEmailVerification(): void + { + + } +} diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php new file mode 100644 index 0000000..852d0bd --- /dev/null +++ b/app/Providers/RouteServiceProvider.php @@ -0,0 +1,49 @@ +mapApiRoutes(); + + $this->mapWebRoutes(); + } + + /** + * Define the "web" routes for the application. + * + * These routes all receive session state, CSRF protection, etc. + */ + protected function mapWebRoutes(): void + { + Route::middleware('web')->group(module_path('Sale', '/routes/web.php')); + } + + /** + * Define the "api" routes for the application. + * + * These routes are typically stateless. + */ + protected function mapApiRoutes(): void + { + Route::middleware('api')->prefix('api')->name('api.')->group(module_path('Sale', '/routes/api.php')); + } +} diff --git a/app/Providers/SaleServiceProvider.php b/app/Providers/SaleServiceProvider.php new file mode 100644 index 0000000..2e72d04 --- /dev/null +++ b/app/Providers/SaleServiceProvider.php @@ -0,0 +1,120 @@ +registerCommands(); + $this->registerCommandSchedules(); + $this->registerTranslations(); + $this->registerConfig(); + $this->registerViews(); + $this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations')); + } + + /** + * Register the service provider. + */ + public function register(): void + { + $this->app->register(EventServiceProvider::class); + $this->app->register(RouteServiceProvider::class); + } + + /** + * Register commands in the format of Command::class + */ + protected function registerCommands(): void + { + // $this->commands([]); + } + + /** + * Register command Schedules. + */ + protected function registerCommandSchedules(): void + { + // $this->app->booted(function () { + // $schedule = $this->app->make(Schedule::class); + // $schedule->command('inspire')->hourly(); + // }); + } + + /** + * Register translations. + */ + public function registerTranslations(): void + { + $langPath = resource_path('lang/modules/' . $this->moduleNameLower); + + if (is_dir($langPath)) { + $this->loadTranslationsFrom($langPath, $this->moduleNameLower); + $this->loadJsonTranslationsFrom($langPath); + } else { + $this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower); + $this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang')); + } + } + + /** + * Register config. + */ + protected function registerConfig(): void + { + $this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower . '.php')], 'config'); + $this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower); + } + + /** + * Register views. + */ + public function registerViews(): void + { + $viewPath = resource_path('views/modules/' . $this->moduleNameLower); + $sourcePath = module_path($this->moduleName, 'resources/views'); + + $this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower . '-module-views']); + + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower); + + $componentNamespace = str_replace('/', '\\', config('modules.namespace') . '\\' . $this->moduleName . '\\' . ltrim(config('modules.paths.generator.component-class.path'), config('modules.paths.app_folder', ''))); + Blade::componentNamespace($componentNamespace, $this->moduleNameLower); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides(): array + { + return []; + } + + /** + * @return array + */ + private function getPublishableViewPaths(): array + { + $paths = []; + foreach (config('view.paths') as $path) { + if (is_dir($path . '/modules/' . $this->moduleNameLower)) { + $paths[] = $path . '/modules/' . $this->moduleNameLower; + } + } + + return $paths; + } +} diff --git a/composer.json b/composer.json index e6f0972..710112a 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "mybizna/sale", "description": "", "type": "asgard-module", - "version": "2024.3", + "version": "2024.4", "license": "GPL-3.0-or-later", "authors": [ { @@ -36,4 +36,4 @@ "Modules\\Sale\\Tests\\": "tests/" } } -} \ No newline at end of file +} diff --git a/config/.gitkeep b/config/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/config/config.php b/config/config.php new file mode 100644 index 0000000..216a6db --- /dev/null +++ b/config/config.php @@ -0,0 +1,5 @@ + 'Sale', +]; diff --git a/routes/.gitkeep b/routes/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/routes/api.php b/routes/api.php new file mode 100755 index 0000000..4e247ba --- /dev/null +++ b/routes/api.php @@ -0,0 +1,12 @@ +