Skip to content

Commit 27af335

Browse files
committed
Release 2024.4
1 parent 6369f84 commit 27af335

File tree

11 files changed

+288
-2
lines changed

11 files changed

+288
-2
lines changed

Diff for: app/Filament/Clusters/Sale.php

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace Modules\Sale\Filament\Clusters;
4+
5+
use Filament\Clusters\Cluster;
6+
use Nwidart\Modules\Facades\Module;
7+
8+
class Sale extends Cluster
9+
{
10+
public static function getModuleName(): string
11+
{
12+
return 'Sale';
13+
}
14+
15+
public static function getModule(): \Nwidart\Modules\Module
16+
{
17+
return Module::findOrFail(static::getModuleName());
18+
}
19+
20+
public static function getNavigationLabel(): string
21+
{
22+
return __('Sale');
23+
}
24+
25+
public static function getNavigationIcon(): ?string
26+
{
27+
return 'heroicon-o-squares-2x2';
28+
}
29+
}

Diff for: app/Filament/SalePlugin.php

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Modules\Sale\Filament;
4+
5+
use Coolsam\Modules\Concerns\ModuleFilamentPlugin;
6+
use Filament\Contracts\Plugin;
7+
use Filament\Panel;
8+
9+
class SalePlugin implements Plugin
10+
{
11+
use ModuleFilamentPlugin;
12+
13+
public function getModuleName(): string
14+
{
15+
return 'Sale';
16+
}
17+
18+
public function getId(): string
19+
{
20+
return 'sale';
21+
}
22+
23+
public function boot(Panel $panel): void
24+
{
25+
// TODO: Implement boot() method.
26+
}
27+
}

Diff for: app/Providers/EventServiceProvider.php

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace Modules\Sale\Providers;
4+
5+
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
6+
7+
class EventServiceProvider extends ServiceProvider
8+
{
9+
/**
10+
* The event handler mappings for the application.
11+
*
12+
* @var array<string, array<int, string>>
13+
*/
14+
protected $listen = [];
15+
16+
/**
17+
* Indicates if events should be discovered.
18+
*
19+
* @var bool
20+
*/
21+
protected static $shouldDiscoverEvents = true;
22+
23+
/**
24+
* Configure the proper event listeners for email verification.
25+
*
26+
* @return void
27+
*/
28+
protected function configureEmailVerification(): void
29+
{
30+
31+
}
32+
}

Diff for: app/Providers/RouteServiceProvider.php

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
3+
namespace Modules\Sale\Providers;
4+
5+
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
6+
use Illuminate\Support\Facades\Route;
7+
8+
class RouteServiceProvider extends ServiceProvider
9+
{
10+
/**
11+
* Called before routes are registered.
12+
*
13+
* Register any model bindings or pattern based filters.
14+
*/
15+
public function boot(): void
16+
{
17+
parent::boot();
18+
}
19+
20+
/**
21+
* Define the routes for the application.
22+
*/
23+
public function map(): void
24+
{
25+
$this->mapApiRoutes();
26+
27+
$this->mapWebRoutes();
28+
}
29+
30+
/**
31+
* Define the "web" routes for the application.
32+
*
33+
* These routes all receive session state, CSRF protection, etc.
34+
*/
35+
protected function mapWebRoutes(): void
36+
{
37+
Route::middleware('web')->group(module_path('Sale', '/routes/web.php'));
38+
}
39+
40+
/**
41+
* Define the "api" routes for the application.
42+
*
43+
* These routes are typically stateless.
44+
*/
45+
protected function mapApiRoutes(): void
46+
{
47+
Route::middleware('api')->prefix('api')->name('api.')->group(module_path('Sale', '/routes/api.php'));
48+
}
49+
}

Diff for: app/Providers/SaleServiceProvider.php

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
<?php
2+
3+
namespace Modules\Sale\Providers;
4+
5+
use Illuminate\Support\Facades\Blade;
6+
use Illuminate\Support\ServiceProvider;
7+
8+
class SaleServiceProvider extends ServiceProvider
9+
{
10+
protected string $moduleName = 'Sale';
11+
12+
protected string $moduleNameLower = 'Sale';
13+
14+
/**
15+
* Boot the application events.
16+
*/
17+
public function boot(): void
18+
{
19+
$this->registerCommands();
20+
$this->registerCommandSchedules();
21+
$this->registerTranslations();
22+
$this->registerConfig();
23+
$this->registerViews();
24+
$this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations'));
25+
}
26+
27+
/**
28+
* Register the service provider.
29+
*/
30+
public function register(): void
31+
{
32+
$this->app->register(EventServiceProvider::class);
33+
$this->app->register(RouteServiceProvider::class);
34+
}
35+
36+
/**
37+
* Register commands in the format of Command::class
38+
*/
39+
protected function registerCommands(): void
40+
{
41+
// $this->commands([]);
42+
}
43+
44+
/**
45+
* Register command Schedules.
46+
*/
47+
protected function registerCommandSchedules(): void
48+
{
49+
// $this->app->booted(function () {
50+
// $schedule = $this->app->make(Schedule::class);
51+
// $schedule->command('inspire')->hourly();
52+
// });
53+
}
54+
55+
/**
56+
* Register translations.
57+
*/
58+
public function registerTranslations(): void
59+
{
60+
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
61+
62+
if (is_dir($langPath)) {
63+
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
64+
$this->loadJsonTranslationsFrom($langPath);
65+
} else {
66+
$this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower);
67+
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang'));
68+
}
69+
}
70+
71+
/**
72+
* Register config.
73+
*/
74+
protected function registerConfig(): void
75+
{
76+
$this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower . '.php')], 'config');
77+
$this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower);
78+
}
79+
80+
/**
81+
* Register views.
82+
*/
83+
public function registerViews(): void
84+
{
85+
$viewPath = resource_path('views/modules/' . $this->moduleNameLower);
86+
$sourcePath = module_path($this->moduleName, 'resources/views');
87+
88+
$this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower . '-module-views']);
89+
90+
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
91+
92+
$componentNamespace = str_replace('/', '\\', config('modules.namespace') . '\\' . $this->moduleName . '\\' . ltrim(config('modules.paths.generator.component-class.path'), config('modules.paths.app_folder', '')));
93+
Blade::componentNamespace($componentNamespace, $this->moduleNameLower);
94+
}
95+
96+
/**
97+
* Get the services provided by the provider.
98+
*
99+
* @return array<string>
100+
*/
101+
public function provides(): array
102+
{
103+
return [];
104+
}
105+
106+
/**
107+
* @return array<string>
108+
*/
109+
private function getPublishableViewPaths(): array
110+
{
111+
$paths = [];
112+
foreach (config('view.paths') as $path) {
113+
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
114+
$paths[] = $path . '/modules/' . $this->moduleNameLower;
115+
}
116+
}
117+
118+
return $paths;
119+
}
120+
}

Diff for: composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "mybizna/sale",
33
"description": "",
44
"type": "asgard-module",
5-
"version": "2024.3",
5+
"version": "2024.4",
66
"license": "GPL-3.0-or-later",
77
"authors": [
88
{
@@ -36,4 +36,4 @@
3636
"Modules\\Sale\\Tests\\": "tests/"
3737
}
3838
}
39-
}
39+
}

Diff for: config/.gitkeep

Whitespace-only changes.

Diff for: config/config.php

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
return [
4+
'name' => 'Sale',
5+
];

Diff for: routes/.gitkeep

Whitespace-only changes.

Diff for: routes/api.php

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
/*
4+
|--------------------------------------------------------------------------
5+
| API Routes
6+
|--------------------------------------------------------------------------
7+
|
8+
| Here is where you can register API routes for your application. These
9+
| routes are loaded by the RouteServiceProvider within a group which
10+
| contains the "api" middleware group. Now create something great!
11+
|
12+
*/

Diff for: routes/web.php

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
/*
4+
|--------------------------------------------------------------------------
5+
| Web Routes
6+
|--------------------------------------------------------------------------
7+
|
8+
| Here is where you can register web routes for your application. These
9+
| routes are loaded by the RouteServiceProvider within a group which
10+
| contains the "web" middleware group. Now create something great!
11+
|
12+
*/

0 commit comments

Comments
 (0)