-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
03c3ce5
commit bec60c5
Showing
24 changed files
with
510 additions
and
2 deletions.
There are no files selected for viewing
Empty file.
67 changes: 67 additions & 0 deletions
67
web/Modules/Customer/App/Http/Controllers/CustomerController.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,67 @@ | ||
<?php | ||
|
||
namespace Modules\Customer\App\Http\Controllers; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\RedirectResponse; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Http\Response; | ||
|
||
class CustomerController extends Controller | ||
{ | ||
/** | ||
* Display a listing of the resource. | ||
*/ | ||
public function index() | ||
{ | ||
return view('customer::index'); | ||
} | ||
|
||
/** | ||
* Show the form for creating a new resource. | ||
*/ | ||
public function create() | ||
{ | ||
return view('customer::create'); | ||
} | ||
|
||
/** | ||
* Store a newly created resource in storage. | ||
*/ | ||
public function store(Request $request): RedirectResponse | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Show the specified resource. | ||
*/ | ||
public function show($id) | ||
{ | ||
return view('customer::show'); | ||
} | ||
|
||
/** | ||
* Show the form for editing the specified resource. | ||
*/ | ||
public function edit($id) | ||
{ | ||
return view('customer::edit'); | ||
} | ||
|
||
/** | ||
* Update the specified resource in storage. | ||
*/ | ||
public function update(Request $request, $id): RedirectResponse | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Remove the specified resource from storage. | ||
*/ | ||
public function destroy($id) | ||
{ | ||
// | ||
} | ||
} |
Empty file.
116 changes: 116 additions & 0 deletions
116
web/Modules/Customer/App/Providers/CustomerServiceProvider.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,116 @@ | ||
<?php | ||
|
||
namespace Modules\Customer\App\Providers; | ||
|
||
use Illuminate\Support\Facades\Blade; | ||
use Illuminate\Support\ServiceProvider; | ||
use Modules\Customer\Providers\Filament\CustomerPanelProvider; | ||
|
||
class CustomerServiceProvider extends ServiceProvider | ||
{ | ||
protected string $moduleName = 'Customer'; | ||
|
||
protected string $moduleNameLower = 'customer'; | ||
|
||
/** | ||
* 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(RouteServiceProvider::class); | ||
$this->app->register(CustomerPanelProvider::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.'\\'.config('modules.paths.generator.component-class.path')); | ||
Blade::componentNamespace($componentNamespace, $this->moduleNameLower); | ||
} | ||
|
||
/** | ||
* Get the services provided by the provider. | ||
*/ | ||
public function provides(): array | ||
{ | ||
return []; | ||
} | ||
|
||
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; | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
web/Modules/Customer/App/Providers/RouteServiceProvider.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,59 @@ | ||
<?php | ||
|
||
namespace Modules\Customer\App\Providers; | ||
|
||
use Illuminate\Support\Facades\Route; | ||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; | ||
|
||
class RouteServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* The module namespace to assume when generating URLs to actions. | ||
*/ | ||
protected string $moduleNamespace = 'Modules\Customer\App\Http\Controllers'; | ||
|
||
/** | ||
* 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') | ||
->namespace($this->moduleNamespace) | ||
->group(module_path('Customer', '/routes/web.php')); | ||
} | ||
|
||
/** | ||
* Define the "api" routes for the application. | ||
* | ||
* These routes are typically stateless. | ||
*/ | ||
protected function mapApiRoutes(): void | ||
{ | ||
Route::prefix('api') | ||
->middleware('api') | ||
->namespace($this->moduleNamespace) | ||
->group(module_path('Customer', '/routes/api.php')); | ||
} | ||
} |
Empty file.
16 changes: 16 additions & 0 deletions
16
web/Modules/Customer/Database/Seeders/CustomerDatabaseSeeder.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,16 @@ | ||
<?php | ||
|
||
namespace Modules\Customer\Database\Seeders; | ||
|
||
use Illuminate\Database\Seeder; | ||
|
||
class CustomerDatabaseSeeder extends Seeder | ||
{ | ||
/** | ||
* Run the database seeds. | ||
*/ | ||
public function run(): void | ||
{ | ||
// $this->call([]); | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
web/Modules/Customer/Providers/Filament/CustomerPanelProvider.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,86 @@ | ||
<?php | ||
|
||
namespace Modules\Customer\Providers\Filament; | ||
|
||
use Filament\Http\Middleware\Authenticate; | ||
use Filament\Http\Middleware\DisableBladeIconComponents; | ||
use Filament\Http\Middleware\DispatchServingFilamentEvent; | ||
use Filament\Pages; | ||
use Filament\Panel; | ||
use Filament\PanelProvider; | ||
use Filament\Support\Colors\Color; | ||
use Filament\Widgets; | ||
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse; | ||
use Illuminate\Cookie\Middleware\EncryptCookies; | ||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken; | ||
use Illuminate\Routing\Middleware\SubstituteBindings; | ||
use Illuminate\Session\Middleware\AuthenticateSession; | ||
use Illuminate\Session\Middleware\StartSession; | ||
use Illuminate\View\Middleware\ShareErrorsFromSession; | ||
|
||
class CustomerPanelProvider extends PanelProvider | ||
{ | ||
private string $module = 'Customer'; | ||
|
||
public function panel(Panel $panel): Panel | ||
{ | ||
$moduleNamespace = $this->getModuleNamespace(); | ||
|
||
$defaultColor = Color::Yellow; | ||
$brandLogo = asset('images/phyre-logo.svg'); | ||
|
||
if (!app()->runningInConsole()) { | ||
$isAppInstalled = file_exists(storage_path('installed')); | ||
if ($isAppInstalled) { | ||
if (setting('general.brand_logo_url')) { | ||
$brandLogo = setting('general.brand_logo_url'); | ||
} | ||
if (setting('general.brand_primary_color')) { | ||
$defaultColor = Color::hex(setting('general.brand_primary_color')); | ||
} | ||
} | ||
} | ||
|
||
return $panel | ||
->id('customer::admin') | ||
->path('customer') | ||
|
||
->font('Albert Sans') | ||
->sidebarWidth('15rem') | ||
// ->brandLogo(fn () => view('filament.admin.logo')) | ||
->brandLogo($brandLogo) | ||
->brandLogoHeight('2.2rem') | ||
->colors([ | ||
'primary'=>$defaultColor, | ||
]) | ||
->discoverResources(in: module_path($this->module, 'Filament/Admin/Resources'), for: "$moduleNamespace\\Filament\\Admin\\Resources") | ||
->discoverPages(in: module_path($this->module, 'Filament/Admin/Pages'), for: "$moduleNamespace\\Filament\\Admin\\Pages") | ||
->pages([ | ||
Pages\Dashboard::class, | ||
]) | ||
->discoverWidgets(in: module_path($this->module, 'Filament/Admin/Widgets'), for: "$moduleNamespace\\Filament\\Admin\\Widgets") | ||
->widgets([ | ||
Widgets\AccountWidget::class, | ||
Widgets\FilamentInfoWidget::class, | ||
]) | ||
->middleware([ | ||
EncryptCookies::class, | ||
AddQueuedCookiesToResponse::class, | ||
StartSession::class, | ||
AuthenticateSession::class, | ||
ShareErrorsFromSession::class, | ||
VerifyCsrfToken::class, | ||
SubstituteBindings::class, | ||
DisableBladeIconComponents::class, | ||
DispatchServingFilamentEvent::class, | ||
]) | ||
->authMiddleware([ | ||
Authenticate::class, | ||
]); | ||
} | ||
|
||
protected function getModuleNamespace(): string | ||
{ | ||
return config('modules.namespace').'\\'.$this->module; | ||
} | ||
} |
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,31 @@ | ||
{ | ||
"name": "nwidart/customer", | ||
"description": "", | ||
"authors": [ | ||
{ | ||
"name": "Nicolas Widart", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"extra": { | ||
"laravel": { | ||
"providers": [], | ||
"aliases": { | ||
|
||
} | ||
} | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Modules\\Customer\\": "", | ||
"Modules\\Customer\\App\\": "app/", | ||
"Modules\\Customer\\Database\\Factories\\": "database/factories/", | ||
"Modules\\Customer\\Database\\Seeders\\": "database/seeders/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Modules\\Customer\\Tests\\": "tests/" | ||
} | ||
} | ||
} |
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' => 'Customer', | ||
]; |
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,11 @@ | ||
{ | ||
"name": "Customer", | ||
"alias": "customer", | ||
"description": "", | ||
"keywords": [], | ||
"priority": 0, | ||
"providers": [ | ||
"Modules\\Customer\\App\\Providers\\CustomerServiceProvider" | ||
], | ||
"files": [] | ||
} |
Oops, something went wrong.