-
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
Showing
50 changed files
with
1,606 additions
and
720 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
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,62 @@ | ||
<?php | ||
|
||
namespace Modules\Master\App\Http\Controllers; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\JsonResponse; | ||
use Illuminate\Http\Request; | ||
|
||
class MasterController extends Controller | ||
{ | ||
public array $data = []; | ||
|
||
/** | ||
* Display a listing of the resource. | ||
*/ | ||
public function index(): JsonResponse | ||
{ | ||
// | ||
|
||
return response()->json($this->data); | ||
} | ||
|
||
/** | ||
* Store a newly created resource in storage. | ||
*/ | ||
public function store(Request $request): JsonResponse | ||
{ | ||
// | ||
|
||
return response()->json($this->data); | ||
} | ||
|
||
/** | ||
* Show the specified resource. | ||
*/ | ||
public function show($id): JsonResponse | ||
{ | ||
// | ||
|
||
return response()->json($this->data); | ||
} | ||
|
||
/** | ||
* Update the specified resource in storage. | ||
*/ | ||
public function update(Request $request, $id): JsonResponse | ||
{ | ||
// | ||
|
||
return response()->json($this->data); | ||
} | ||
|
||
/** | ||
* Remove the specified resource from storage. | ||
*/ | ||
public function destroy($id): JsonResponse | ||
{ | ||
// | ||
|
||
return response()->json($this->data); | ||
} | ||
} |
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,114 @@ | ||
<?php | ||
|
||
namespace Modules\Master\App\Providers; | ||
|
||
use Illuminate\Support\Facades\Blade; | ||
use Illuminate\Support\ServiceProvider; | ||
|
||
class MasterServiceProvider extends ServiceProvider | ||
{ | ||
protected string $moduleName = 'Master'; | ||
|
||
protected string $moduleNameLower = 'master'; | ||
|
||
/** | ||
* 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); | ||
} | ||
|
||
/** | ||
* 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; | ||
} | ||
} |
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\Master\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\Master\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('Master', '/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('Master', '/routes/api.php')); | ||
} | ||
} |
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,16 @@ | ||
<?php | ||
|
||
namespace Modules\Master\Database\Seeders; | ||
|
||
use Illuminate\Database\Seeder; | ||
|
||
class MasterDatabaseSeeder extends Seeder | ||
{ | ||
/** | ||
* Run the database seeds. | ||
*/ | ||
public function run(): void | ||
{ | ||
// $this->call([]); | ||
} | ||
} |
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/master", | ||
"description": "", | ||
"authors": [ | ||
{ | ||
"name": "Nicolas Widart", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"extra": { | ||
"laravel": { | ||
"providers": [], | ||
"aliases": { | ||
|
||
} | ||
} | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Modules\\Master\\": "", | ||
"Modules\\Master\\App\\": "app/", | ||
"Modules\\Master\\Database\\Factories\\": "database/factories/", | ||
"Modules\\Master\\Database\\Seeders\\": "database/seeders/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Modules\\Master\\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' => 'Master', | ||
]; |
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": "Master", | ||
"alias": "master", | ||
"description": "", | ||
"keywords": [], | ||
"priority": 0, | ||
"providers": [ | ||
"Modules\\Master\\App\\Providers\\MasterServiceProvider" | ||
], | ||
"files": [] | ||
} |
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,15 @@ | ||
{ | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build" | ||
}, | ||
"devDependencies": { | ||
"axios": "^1.1.2", | ||
"laravel-vite-plugin": "^0.7.5", | ||
"sass": "^1.69.5", | ||
"postcss": "^8.3.7", | ||
"vite": "^4.0.0" | ||
} | ||
} |
Empty file.
Empty file.
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,7 @@ | ||
@extends('master::layouts.master') | ||
|
||
@section('content') | ||
<h1>Hello World</h1> | ||
|
||
<p>Module: {!! config('master.name') !!}</p> | ||
@endsection |
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 @@ | ||
<!DOCTYPE html> | ||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<meta name="csrf-token" content="{{ csrf_token() }}"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
|
||
<title>Master Module - {{ config('app.name', 'Laravel') }}</title> | ||
|
||
<meta name="description" content="{{ $description ?? '' }}"> | ||
<meta name="keywords" content="{{ $keywords ?? '' }}"> | ||
<meta name="author" content="{{ $author ?? '' }}"> | ||
|
||
<!-- Fonts --> | ||
<link rel="preconnect" href="https://fonts.bunny.net"> | ||
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" /> | ||
|
||
{{-- Vite CSS --}} | ||
{{-- {{ module_vite('build-master', 'resources/assets/sass/app.scss') }} --}} | ||
</head> | ||
|
||
<body> | ||
@yield('content') | ||
|
||
{{-- Vite JS --}} | ||
{{-- {{ module_vite('build-master', 'resources/assets/js/app.tsx') }} --}} | ||
</body> |
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,19 @@ | ||
<?php | ||
|
||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Route; | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| API Routes | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here is where you can register API routes for your application. These | ||
| routes are loaded by the RouteServiceProvider within a group which | ||
| is assigned the "api" middleware group. Enjoy building your API! | ||
| | ||
*/ | ||
|
||
Route::middleware(['auth:sanctum'])->prefix('v1')->name('api.')->group(function () { | ||
Route::get('master', fn (Request $request) => $request->user())->name('master'); | ||
}); |
Oops, something went wrong.