-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6369f84
commit 27af335
Showing
11 changed files
with
288 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace Modules\Sale\Filament\Clusters; | ||
|
||
use Filament\Clusters\Cluster; | ||
use Nwidart\Modules\Facades\Module; | ||
|
||
class Sale extends Cluster | ||
{ | ||
public static function getModuleName(): string | ||
{ | ||
return 'Sale'; | ||
} | ||
|
||
public static function getModule(): \Nwidart\Modules\Module | ||
{ | ||
return Module::findOrFail(static::getModuleName()); | ||
} | ||
|
||
public static function getNavigationLabel(): string | ||
{ | ||
return __('Sale'); | ||
} | ||
|
||
public static function getNavigationIcon(): ?string | ||
{ | ||
return 'heroicon-o-squares-2x2'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace Modules\Sale\Filament; | ||
|
||
use Coolsam\Modules\Concerns\ModuleFilamentPlugin; | ||
use Filament\Contracts\Plugin; | ||
use Filament\Panel; | ||
|
||
class SalePlugin implements Plugin | ||
{ | ||
use ModuleFilamentPlugin; | ||
|
||
public function getModuleName(): string | ||
{ | ||
return 'Sale'; | ||
} | ||
|
||
public function getId(): string | ||
{ | ||
return 'sale'; | ||
} | ||
|
||
public function boot(Panel $panel): void | ||
{ | ||
// TODO: Implement boot() method. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Modules\Sale\Providers; | ||
|
||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; | ||
|
||
class EventServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* The event handler mappings for the application. | ||
* | ||
* @var array<string, array<int, string>> | ||
*/ | ||
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 | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
namespace Modules\Sale\Providers; | ||
|
||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; | ||
use Illuminate\Support\Facades\Route; | ||
|
||
class RouteServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* Called before routes are registered. | ||
* | ||
* Register any model bindings or pattern based filters. | ||
*/ | ||
public function boot(): void | ||
{ | ||
parent::boot(); | ||
} | ||
|
||
/** | ||
* Define the routes for the application. | ||
*/ | ||
public function map(): void | ||
{ | ||
$this->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')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
<?php | ||
|
||
namespace Modules\Sale\Providers; | ||
|
||
use Illuminate\Support\Facades\Blade; | ||
use Illuminate\Support\ServiceProvider; | ||
|
||
class SaleServiceProvider extends ServiceProvider | ||
{ | ||
protected string $moduleName = 'Sale'; | ||
|
||
protected string $moduleNameLower = 'Sale'; | ||
|
||
/** | ||
* Boot the application events. | ||
*/ | ||
public function boot(): void | ||
{ | ||
$this->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<string> | ||
*/ | ||
public function provides(): array | ||
{ | ||
return []; | ||
} | ||
|
||
/** | ||
* @return array<string> | ||
*/ | ||
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
return [ | ||
'name' => 'Sale', | ||
]; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| API Routes | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here is where you can register API routes for your application. These | ||
| routes are loaded by the RouteServiceProvider within a group which | ||
| contains the "api" middleware group. Now create something great! | ||
| | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Web Routes | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here is where you can register web routes for your application. These | ||
| routes are loaded by the RouteServiceProvider within a group which | ||
| contains the "web" middleware group. Now create something great! | ||
| | ||
*/ |