templave v1

This commit is contained in:
2026-03-06 08:57:05 +02:00
commit 17dbdad28b
50 changed files with 8720 additions and 0 deletions

90
src/.env.example Normal file
View File

@@ -0,0 +1,90 @@
# Laravel Environment Configuration
#
# This template supports multiple databases. Copy the appropriate file:
# - .env.mysql - MySQL configuration
# - .env.pgsql - PostgreSQL configuration
# - .env.sqlite - SQLite configuration
#
# Example: cp .env.mysql .env
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_TIMEZONE=UTC
APP_URL=http://localhost:8080
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
APP_MAINTENANCE_STORE=database
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
# Database: Choose one configuration
# ===================================
# MySQL:
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=laravel
DB_PASSWORD=secret
# PostgreSQL (uncomment and comment MySQL above):
# DB_CONNECTION=pgsql
# DB_HOST=pgsql
# DB_PORT=5432
# DB_DATABASE=laravel
# DB_USERNAME=laravel
# DB_PASSWORD=secret
# SQLite (uncomment and comment MySQL above):
# DB_CONNECTION=sqlite
# DB_DATABASE=/var/www/html/database/database.sqlite
SESSION_DRIVER=redis
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=redis
CACHE_STORE=redis
CACHE_PREFIX=
REDIS_CLIENT=phpredis
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
VITE_APP_NAME="${APP_NAME}"
# Error Logging - Flare (https://flareapp.io)
# Get your key at: https://flareapp.io
FLARE_KEY=
# Ignition Settings (Development)
# Themes: light, dark, auto
# Editors: vscode, phpstorm, sublime, atom, textmate
IGNITION_THEME=auto
IGNITION_EDITOR=vscode

64
src/.env.mysql Normal file
View File

@@ -0,0 +1,64 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_TIMEZONE=UTC
APP_URL=http://localhost:8080
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
APP_MAINTENANCE_STORE=database
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=laravel
DB_PASSWORD=secret
SESSION_DRIVER=redis
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=redis
CACHE_STORE=redis
CACHE_PREFIX=
REDIS_CLIENT=phpredis
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
VITE_APP_NAME="${APP_NAME}"
# Error Logging - Flare (https://flareapp.io)
# Get your key at: https://flareapp.io
FLARE_KEY=
# Ignition Settings (Development)
IGNITION_THEME=auto
IGNITION_EDITOR=vscode

64
src/.env.pgsql Normal file
View File

@@ -0,0 +1,64 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_TIMEZONE=UTC
APP_URL=http://localhost:8080
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
APP_MAINTENANCE_STORE=database
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=pgsql
DB_HOST=pgsql
DB_PORT=5432
DB_DATABASE=laravel
DB_USERNAME=laravel
DB_PASSWORD=secret
SESSION_DRIVER=redis
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=redis
CACHE_STORE=redis
CACHE_PREFIX=
REDIS_CLIENT=phpredis
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
VITE_APP_NAME="${APP_NAME}"
# Error Logging - Flare (https://flareapp.io)
# Get your key at: https://flareapp.io
FLARE_KEY=
# Ignition Settings (Development)
IGNITION_THEME=auto
IGNITION_EDITOR=vscode

60
src/.env.sqlite Normal file
View File

@@ -0,0 +1,60 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_TIMEZONE=UTC
APP_URL=http://localhost:8080
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
APP_MAINTENANCE_STORE=database
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=sqlite
DB_DATABASE=/var/www/html/database/database.sqlite
SESSION_DRIVER=redis
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=redis
CACHE_STORE=redis
CACHE_PREFIX=
REDIS_CLIENT=phpredis
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
VITE_APP_NAME="${APP_NAME}"
# Error Logging - Flare (https://flareapp.io)
# Get your key at: https://flareapp.io
FLARE_KEY=
# Ignition Settings (Development)
IGNITION_THEME=auto
IGNITION_EDITOR=vscode

2
src/.gitkeep Normal file
View File

@@ -0,0 +1,2 @@
# This directory will contain your Laravel application
# Run: docker-compose run --rm app composer create-project laravel/laravel .

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,121 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\File;
use Illuminate\Support\ServiceProvider;
class ModuleServiceProvider extends ServiceProvider
{
/**
* Register services.
*/
public function register(): void
{
$this->registerModules();
}
/**
* Bootstrap services.
*/
public function boot(): void
{
$this->bootModules();
}
/**
* Register all modules.
*/
protected function registerModules(): void
{
$modulesPath = app_path('Modules');
if (!File::isDirectory($modulesPath)) {
return;
}
$modules = File::directories($modulesPath);
foreach ($modules as $modulePath) {
$moduleName = basename($modulePath);
$providerClass = "App\\Modules\\{$moduleName}\\{$moduleName}ServiceProvider";
if (class_exists($providerClass)) {
$this->app->register($providerClass);
}
}
}
/**
* Boot all modules.
*/
protected function bootModules(): void
{
$modulesPath = app_path('Modules');
if (!File::isDirectory($modulesPath)) {
return;
}
$modules = File::directories($modulesPath);
foreach ($modules as $modulePath) {
$moduleName = basename($modulePath);
// Load module config
$configPath = "{$modulePath}/Config";
if (File::isDirectory($configPath)) {
foreach (File::files($configPath) as $file) {
$this->mergeConfigFrom(
$file->getPathname(),
strtolower($moduleName) . '.' . $file->getFilenameWithoutExtension()
);
}
}
// Load module routes
$this->loadModuleRoutes($modulePath, $moduleName);
// Load module views
$viewsPath = "{$modulePath}/Resources/views";
if (File::isDirectory($viewsPath)) {
$this->loadViewsFrom($viewsPath, strtolower(preg_replace('/(?<!^)[A-Z]/', '-$0', $moduleName)));
}
// Load module migrations
$migrationsPath = "{$modulePath}/Database/Migrations";
if (File::isDirectory($migrationsPath)) {
$this->loadMigrationsFrom($migrationsPath);
}
// Load module translations
$langPath = "{$modulePath}/Resources/lang";
if (File::isDirectory($langPath)) {
$this->loadTranslationsFrom($langPath, strtolower($moduleName));
}
}
}
/**
* Load module routes.
*/
protected function loadModuleRoutes(string $modulePath, string $moduleName): void
{
$routesPath = "{$modulePath}/Routes";
if (!File::isDirectory($routesPath)) {
return;
}
$webRoutes = "{$routesPath}/web.php";
$apiRoutes = "{$routesPath}/api.php";
if (File::exists($webRoutes)) {
$this->loadRoutesFrom($webRoutes);
}
if (File::exists($apiRoutes)) {
$this->loadRoutesFrom($apiRoutes);
}
}
}

View File

@@ -0,0 +1,41 @@
<?php
/**
* CORS Configuration Example
*
* Copy this to config/cors.php in your Laravel app if you need
* to customize CORS settings beyond the defaults.
*/
return [
/*
|--------------------------------------------------------------------------
| Cross-Origin Resource Sharing (CORS) Configuration
|--------------------------------------------------------------------------
|
| Settings for handling Cross-Origin Resource Sharing (CORS).
| Adjust these based on your API requirements.
|
*/
'paths' => ['api/*', 'sanctum/csrf-cookie'],
'allowed_methods' => ['*'],
'allowed_origins' => [
env('FRONTEND_URL', 'http://localhost:3000'),
// Add other allowed origins here
],
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => true,
];

45
src/pint.json Normal file
View File

@@ -0,0 +1,45 @@
{
"preset": "laravel",
"rules": {
"array_indentation": true,
"array_syntax": {
"syntax": "short"
},
"binary_operator_spaces": {
"default": "single_space"
},
"blank_line_after_namespace": true,
"blank_line_after_opening_tag": true,
"blank_line_before_statement": {
"statements": ["return", "throw", "try"]
},
"class_attributes_separation": {
"elements": {
"method": "one"
}
},
"concat_space": {
"spacing": "none"
},
"declare_strict_types": false,
"fully_qualified_strict_types": true,
"method_argument_space": {
"on_multiline": "ensure_fully_multiline",
"keep_multiple_spaces_after_comma": false
},
"no_unused_imports": true,
"ordered_imports": {
"sort_algorithm": "alpha"
},
"single_quote": true,
"trailing_comma_in_multiline": {
"elements": ["arrays", "arguments", "parameters"]
}
},
"exclude": [
"vendor",
"node_modules",
"storage",
"bootstrap/cache"
]
}

View File

@@ -0,0 +1,94 @@
<?php
/**
* API Routes Example
*
* This file provides a starting template for API routes with Sanctum.
* Copy/merge this into routes/api.php
*/
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Public API Routes
|--------------------------------------------------------------------------
*/
Route::get('/health', function () {
return response()->json([
'status' => 'ok',
'timestamp' => now()->toISOString(),
]);
});
/*
|--------------------------------------------------------------------------
| Authentication Routes (if using Breeze API or custom)
|--------------------------------------------------------------------------
*/
// Route::post('/register', [AuthController::class, 'register']);
// Route::post('/login', [AuthController::class, 'login']);
// Route::post('/forgot-password', [AuthController::class, 'forgotPassword']);
// Route::post('/reset-password', [AuthController::class, 'resetPassword']);
/*
|--------------------------------------------------------------------------
| Protected API Routes (require authentication)
|--------------------------------------------------------------------------
*/
Route::middleware('auth:sanctum')->group(function () {
// Current user
Route::get('/user', function (Request $request) {
return $request->user();
});
// Logout
Route::post('/logout', function (Request $request) {
$request->user()->currentAccessToken()->delete();
return response()->json(['message' => 'Logged out']);
});
// User tokens management
Route::get('/tokens', function (Request $request) {
return $request->user()->tokens;
});
Route::delete('/tokens/{tokenId}', function (Request $request, $tokenId) {
$request->user()->tokens()->where('id', $tokenId)->delete();
return response()->json(['message' => 'Token revoked']);
});
/*
|--------------------------------------------------------------------------
| Your API Resources
|--------------------------------------------------------------------------
| Add your protected API routes here
|
| Example:
| Route::apiResource('posts', PostController::class);
| Route::apiResource('comments', CommentController::class);
|
*/
});
/*
|--------------------------------------------------------------------------
| API Versioning Example
|--------------------------------------------------------------------------
| Uncomment to use versioned API routes
|
| Route::prefix('v1')->group(function () {
| Route::apiResource('posts', Api\V1\PostController::class);
| });
|
| Route::prefix('v2')->group(function () {
| Route::apiResource('posts', Api\V2\PostController::class);
| });
|
*/