Premier commit
This commit is contained in:
18
.editorconfig
Normal file
18
.editorconfig
Normal file
@@ -0,0 +1,18 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
||||
|
||||
[compose.yaml]
|
||||
indent_size = 4
|
||||
65
.env.example
Normal file
65
.env.example
Normal file
@@ -0,0 +1,65 @@
|
||||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
APP_LOCALE=en
|
||||
APP_FALLBACK_LOCALE=en
|
||||
APP_FAKER_LOCALE=en_US
|
||||
|
||||
APP_MAINTENANCE_DRIVER=file
|
||||
# APP_MAINTENANCE_STORE=database
|
||||
|
||||
# PHP_CLI_SERVER_WORKERS=4
|
||||
|
||||
BCRYPT_ROUNDS=12
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_STACK=single
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=sqlite
|
||||
# DB_HOST=127.0.0.1
|
||||
# DB_PORT=3306
|
||||
# DB_DATABASE=laravel
|
||||
# DB_USERNAME=root
|
||||
# DB_PASSWORD=
|
||||
|
||||
SESSION_DRIVER=database
|
||||
SESSION_LIFETIME=120
|
||||
SESSION_ENCRYPT=false
|
||||
SESSION_PATH=/
|
||||
SESSION_DOMAIN=null
|
||||
|
||||
BROADCAST_CONNECTION=log
|
||||
FILESYSTEM_DISK=local
|
||||
QUEUE_CONNECTION=database
|
||||
|
||||
CACHE_STORE=database
|
||||
# CACHE_PREFIX=
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_CLIENT=phpredis
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=log
|
||||
MAIL_SCHEME=null
|
||||
MAIL_HOST=127.0.0.1
|
||||
MAIL_PORT=2525
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_FROM_ADDRESS="hello@example.com"
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
VITE_APP_NAME="${APP_NAME}"
|
||||
11
.gitattributes
vendored
Normal file
11
.gitattributes
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
* text=auto eol=lf
|
||||
|
||||
*.blade.php diff=html
|
||||
*.css diff=css
|
||||
*.html diff=html
|
||||
*.md diff=markdown
|
||||
*.php diff=php
|
||||
|
||||
/.github export-ignore
|
||||
CHANGELOG.md export-ignore
|
||||
.styleci.yml export-ignore
|
||||
24
.gitignore
vendored
Normal file
24
.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
*.log
|
||||
.DS_Store
|
||||
.env
|
||||
.env.backup
|
||||
.env.production
|
||||
.phpactor.json
|
||||
.phpunit.result.cache
|
||||
/.fleet
|
||||
/.idea
|
||||
/.nova
|
||||
/.phpunit.cache
|
||||
/.vscode
|
||||
/.zed
|
||||
/auth.json
|
||||
/node_modules
|
||||
/public/build
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/storage/pail
|
||||
/vendor
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
Thumbs.db
|
||||
61
README.md
Normal file
61
README.md
Normal file
@@ -0,0 +1,61 @@
|
||||
# DSIGEST - Gestion de Contrats IT
|
||||
|
||||
Application de gestion de contrats IT pour une communauté d'agglomération.
|
||||
|
||||
## Stack
|
||||
- Backend: Laravel 12, PHP 8.3, MySQL
|
||||
- Frontend: Vue.js 3 + Bootstrap 5 (intégré via Blade)
|
||||
- Auth: Custom (Login/Register avec validation Admin)
|
||||
|
||||
## Installation
|
||||
|
||||
1. Cloner le repo / Extraire les fichiers.
|
||||
2. Installer les dépendances :
|
||||
```bash
|
||||
composer install
|
||||
npm install
|
||||
```
|
||||
3. Configurer `.env` :
|
||||
- Copier `.env.example` vers `.env`.
|
||||
- Configurer la connexion MySQL (`DB_CONNECTION=mysql`, `DB_DATABASE=...`, etc).
|
||||
4. Générer la clé :
|
||||
```bash
|
||||
php artisan key:generate
|
||||
```
|
||||
5. Migrations et Seeders :
|
||||
```bash
|
||||
php artisan migrate --seed
|
||||
```
|
||||
Ceci créera :
|
||||
- Admin: `admin@dsigest.local` / `password`
|
||||
- Manager: `manager@dsigest.local` / `password`
|
||||
|
||||
6. Compiler les assets Frontend :
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
Pour le développement :
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
## Fonctionnalités
|
||||
|
||||
- **Roles** : Admin, Gestionnaire (Manager), Lecteur.
|
||||
- **Admin Validation** : Les nouveaux inscrits doivent être validés par un Admin (`is_active = true`).
|
||||
- **Contrats** : CRUD complet + Types (Microsoft 365, Fibre, etc).
|
||||
- **Meta-données** : Champs dynamiques clé/valeur pour chaque contrat.
|
||||
- **Documents** : Upload de fichiers attachés aux contrats.
|
||||
- **Audit Logs** : Traçabilité des actions (Création, Modification, Suppression).
|
||||
- **Alertes** : Commande pour vérifier les échéances :
|
||||
```bash
|
||||
php artisan contracts:check-expirations
|
||||
```
|
||||
Ajouter cette commande au CRON du serveur.
|
||||
|
||||
## Structure
|
||||
|
||||
- `app/Models/Contract.php` : Modèle principal.
|
||||
- `app/Http/Controllers/ContractController.php` : Logique CRUD.
|
||||
- `resources/js/components/ContractsTable.vue` : Composant Vue.js tableau avec filtres.
|
||||
- `resources/views/` : Vues Blade utilisant Bootstrap 5.
|
||||
69
app/Console/Commands/SendContractAlerts.php
Normal file
69
app/Console/Commands/SendContractAlerts.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Contract;
|
||||
use App\Models\User;
|
||||
use App\Mail\ContractExpiringNotification;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class SendContractAlerts extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'contracts:check-expirations';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Check for expiring contracts and notify admins';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->info('Checking for expiring contracts...');
|
||||
|
||||
$expiringContracts = Contract::where('status', '!=', 'expired') // Assuming 'active' or 'pending'
|
||||
->where('end_date', '<=', now()->addDays(30))
|
||||
->where('end_date', '>=', now())
|
||||
->get();
|
||||
|
||||
if ($expiringContracts->isEmpty()) {
|
||||
$this->info('No contracts expiring soon.');
|
||||
return;
|
||||
}
|
||||
|
||||
$admins = User::where('role', 'admin')->get();
|
||||
|
||||
if ($admins->isEmpty()) {
|
||||
$this->warn('No admins found to notify.');
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($admins as $admin) {
|
||||
// In a real app, you might group these or send one email per contract/batch
|
||||
// Here we just simulate sending a notification for the batch
|
||||
// Or send individual emails
|
||||
|
||||
// Simplification: Send one email with list
|
||||
try {
|
||||
Mail::to($admin->email)->send(new ContractExpiringNotification($expiringContracts));
|
||||
$this->info("Notification sent to {$admin->email}");
|
||||
} catch (\Exception $e) {
|
||||
$this->error("Failed to send email to {$admin->email}: " . $e->getMessage());
|
||||
Log::error($e);
|
||||
}
|
||||
}
|
||||
|
||||
$this->info('Done.');
|
||||
}
|
||||
}
|
||||
80
app/Console/Commands/TestCortexConnection.php
Normal file
80
app/Console/Commands/TestCortexConnection.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Services\CortexXdrService;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
class TestCortexConnection extends Command
|
||||
{
|
||||
protected $signature = 'cortex:test';
|
||||
protected $description = 'Test connectivity to Cortex XDR API and display results.';
|
||||
|
||||
public function handle(CortexXdrService $cortexService)
|
||||
{
|
||||
$this->info("--- Cortex XDR Connectivity Test ---");
|
||||
|
||||
// 1. Config Check
|
||||
$key = Config::get('services.cortex.key');
|
||||
$id = Config::get('services.cortex.id');
|
||||
$url = Config::get('services.cortex.url');
|
||||
|
||||
$this->line("\n1. Checking Environment Variables:");
|
||||
$this->line(" - API Key: " . ($key ? 'OK (' . substr($key, 0, 5) . '...)' : 'MISSING'));
|
||||
$this->line(" - API Key ID: " . ($id ? 'OK (' . $id . ')' : 'MISSING'));
|
||||
$this->line(" - Base URL: " . ($url ? 'OK (' . $url . ')' : 'MISSING'));
|
||||
|
||||
if (!$key || !$id || !$url) {
|
||||
$this->error("\n[ERROR] Configuration is incomplete.");
|
||||
$this->line("You need to add the following variables to your .env file:");
|
||||
if (!$key) $this->line(" - CORTEX_XDR_API_KEY=your_api_key");
|
||||
if (!$id) $this->line(" - CORTEX_XDR_API_KEY_ID=your_key_id (Integer ID)");
|
||||
if (!$url) $this->line(" - CORTEX_XDR_BASE_URL=https://api-fqdn.xdr.cortex.paloaltonetworks.com");
|
||||
|
||||
$this->warn("\nIMPORTANT: After editing .env, you may need to restart 'php artisan serve' for the web app to see changes.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// 2. Test Incidents
|
||||
$this->info("\n2. Testing API Connection (Incidents)...");
|
||||
try {
|
||||
$incidents = $cortexService->getIncidents();
|
||||
if (empty($incidents)) {
|
||||
$this->warn("No incidents returned. (This might be normal if no incidents exist, or check API permissions).");
|
||||
} else {
|
||||
$this->info("SUCCESS: Fetched " . count($incidents) . " incidents.");
|
||||
if (count($incidents) > 0) {
|
||||
$this->line("DEBUG: First Incident ID: " . ($incidents[0]['incident_id'] ?? 'N/A'));
|
||||
$this->line("DEBUG: Incident keys: " . print_r(array_keys($incidents[0]), true));
|
||||
$this->line("DEBUG: Incident values: " . print_r(array_values($incidents[0]), true));
|
||||
}
|
||||
$this->line("Latest Incident ID: " . ($incidents[0]['incident_id'] ?? 'N/A'));
|
||||
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->error("EXCEPTION: " . $e->getMessage());
|
||||
}
|
||||
|
||||
// 3. Test Endpoints
|
||||
$this->info("\n3. Testing API Connection (Endpoints)...");
|
||||
try {
|
||||
$endpoints = $cortexService->getEndpoints();
|
||||
if (empty($endpoints)) {
|
||||
$this->warn("No endpoints returned.");
|
||||
} else {
|
||||
$this->info("SUCCESS: Fetched " . count($endpoints) . " endpoints.");
|
||||
if (count($endpoints) > 0) {
|
||||
$ep = $endpoints[0];
|
||||
$this->line("DEBUG: First Endpoint Status key: 'endpoint_status' => " . ($ep['endpoint_status'] ?? 'N/A'));
|
||||
$this->line("DEBUG: Keys available: " . print_r(array_keys($ep), true));
|
||||
$this->line("DEBUG: First Endpoint Status key: 'endpoint_status' => " . ($ep['endpoint_status'] ?? 'N/A'));
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->error("EXCEPTION: " . $e->getMessage());
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
36
app/Http/Controllers/Admin/LicenseLevelController.php
Normal file
36
app/Http/Controllers/Admin/LicenseLevelController.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use App\Models\LicenseLevel;
|
||||
|
||||
class LicenseLevelController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$levels = LicenseLevel::all();
|
||||
return view('admin.license_levels.index', compact('levels'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate(['name' => 'required|unique:license_levels,name']);
|
||||
LicenseLevel::create($request->only('name'));
|
||||
return back()->with('success', 'Niveau de licence ajouté.');
|
||||
}
|
||||
|
||||
public function toggle(LicenseLevel $licenseLevel)
|
||||
{
|
||||
$licenseLevel->update(['is_active' => !$licenseLevel->is_active]);
|
||||
return back()->with('success', 'Statut mis à jour.');
|
||||
}
|
||||
|
||||
public function destroy(LicenseLevel $licenseLevel)
|
||||
{
|
||||
$licenseLevel->delete();
|
||||
return back()->with('success', 'Niveau de licence supprimé.');
|
||||
}
|
||||
}
|
||||
63
app/Http/Controllers/Admin/LinkController.php
Normal file
63
app/Http/Controllers/Admin/LinkController.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Link;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class LinkController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$links = Link::orderBy('order', 'asc')->get();
|
||||
return view('admin.links.index', compact('links'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'title' => 'required|string|max:255',
|
||||
'url' => 'required|url',
|
||||
'icon' => 'nullable|string',
|
||||
'color' => 'nullable|string',
|
||||
'order' => 'integer',
|
||||
]);
|
||||
|
||||
Link::create($validated);
|
||||
|
||||
return back()->with('success', 'Lien ajouté.');
|
||||
}
|
||||
|
||||
public function edit(Link $link)
|
||||
{
|
||||
return view('admin.links.edit', compact('link'));
|
||||
}
|
||||
|
||||
public function update(Request $request, Link $link)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'title' => 'required|string|max:255',
|
||||
'url' => 'required|url',
|
||||
'icon' => 'nullable|string',
|
||||
'color' => 'nullable|string',
|
||||
'order' => 'integer',
|
||||
]);
|
||||
|
||||
$link->update($validated);
|
||||
|
||||
return redirect()->route('admin.links.index')->with('success', 'Lien mis à jour.');
|
||||
}
|
||||
|
||||
public function toggle(Link $link)
|
||||
{
|
||||
$link->update(['is_active' => !$link->is_active]);
|
||||
return back()->with('success', 'Statut mis à jour.');
|
||||
}
|
||||
|
||||
public function destroy(Link $link)
|
||||
{
|
||||
$link->delete();
|
||||
return back()->with('success', 'Lien supprimé.');
|
||||
}
|
||||
}
|
||||
23
app/Http/Controllers/Admin/MunicipalityController.php
Normal file
23
app/Http/Controllers/Admin/MunicipalityController.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use App\Models\Municipality;
|
||||
|
||||
class MunicipalityController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$municipalities = Municipality::all();
|
||||
return view('admin.municipalities.index', compact('municipalities'));
|
||||
}
|
||||
|
||||
public function toggle(Municipality $municipality)
|
||||
{
|
||||
$municipality->update(['is_active' => !$municipality->is_active]);
|
||||
return back()->with('success', 'Statut de la commune mis à jour.');
|
||||
}
|
||||
}
|
||||
76
app/Http/Controllers/AuthController.php
Normal file
76
app/Http/Controllers/AuthController.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Validation\Defaults\Password;
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
public function showLogin()
|
||||
{
|
||||
return view('auth.login');
|
||||
}
|
||||
|
||||
public function login(Request $request)
|
||||
{
|
||||
$credentials = $request->validate([
|
||||
'email' => ['required', 'email'],
|
||||
'password' => ['required'],
|
||||
]);
|
||||
|
||||
if (Auth::attempt($credentials, $request->boolean('remember'))) {
|
||||
$request->session()->regenerate();
|
||||
if (!Auth::user()->is_active) {
|
||||
Auth::logout();
|
||||
$request->session()->invalidate();
|
||||
$request->session()->regenerateToken();
|
||||
return back()->withErrors(['email' => 'Your account is pending approval by an administrator.']);
|
||||
}
|
||||
return redirect()->intended('/dashboard');
|
||||
}
|
||||
|
||||
return back()->withErrors([
|
||||
'email' => 'The provided credentials do not match our records.',
|
||||
])->onlyInput('email');
|
||||
}
|
||||
|
||||
public function showRegister()
|
||||
{
|
||||
return view('auth.register');
|
||||
}
|
||||
|
||||
public function register(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
||||
'password' => ['required', 'confirmed', Password::defaults()],
|
||||
]);
|
||||
|
||||
$user = User::create([
|
||||
'name' => $validated['name'],
|
||||
'email' => $validated['email'],
|
||||
'password' => Hash::make($validated['password']),
|
||||
'is_active' => false, // Require approval
|
||||
'role' => 'reader', // Default
|
||||
]);
|
||||
|
||||
Auth::login($user);
|
||||
|
||||
// Notify admin in real app
|
||||
|
||||
return redirect('/dashboard')->with('status', 'Account created. Wait for approval.');
|
||||
}
|
||||
|
||||
public function logout(Request $request)
|
||||
{
|
||||
Auth::logout();
|
||||
$request->session()->invalidate();
|
||||
$request->session()->regenerateToken();
|
||||
return redirect('/');
|
||||
}
|
||||
}
|
||||
148
app/Http/Controllers/ContractController.php
Normal file
148
app/Http/Controllers/ContractController.php
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Contract;
|
||||
use App\Models\ContractMeta;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
|
||||
class ContractController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$contracts = Contract::with('municipality')->latest()->paginate(10);
|
||||
return view('contracts.index', compact('contracts'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
if (!auth()->user()->isManager()) {
|
||||
abort(403);
|
||||
}
|
||||
$municipalities = \App\Models\Municipality::active()->orderBy('name')->get();
|
||||
$licenseLevels = \App\Models\LicenseLevel::active()->orderBy('name')->get();
|
||||
return view('contracts.create', compact('municipalities', 'licenseLevels'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
if (!auth()->user()->isManager()) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
$validated = $request->validate([
|
||||
'name' => 'required|string|max:255',
|
||||
'reference' => 'nullable|string|unique:contracts',
|
||||
'provider' => 'required|string',
|
||||
'municipality_id' => 'nullable|exists:municipalities,id',
|
||||
'start_date' => 'required|date',
|
||||
'end_date' => 'nullable|date|after_or_equal:start_date',
|
||||
'amount' => 'nullable|numeric',
|
||||
'type' => 'required|string',
|
||||
'meta' => 'nullable|array', // key-value pairs
|
||||
]);
|
||||
|
||||
$contract = Contract::create($validated);
|
||||
|
||||
if ($request->has('meta')) {
|
||||
foreach ($request->meta as $key => $value) {
|
||||
if ($value) {
|
||||
$contract->meta()->create(['key' => $key, 'value' => $value]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->route('contracts.index')
|
||||
->with('success', 'Contract created successfully.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(Contract $contract)
|
||||
{
|
||||
$contract->load(['meta', 'documents', 'municipality']);
|
||||
return view('contracts.show', compact('contract'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(Contract $contract)
|
||||
{
|
||||
if (!auth()->user()->isManager()) {
|
||||
abort(403);
|
||||
}
|
||||
$contract->load('meta');
|
||||
$municipalities = \App\Models\Municipality::active()->orderBy('name')->get();
|
||||
$licenseLevels = \App\Models\LicenseLevel::active()->orderBy('name')->get();
|
||||
return view('contracts.edit', compact('contract', 'municipalities', 'licenseLevels'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, Contract $contract)
|
||||
{
|
||||
if (!auth()->user()->isManager()) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
$validated = $request->validate([
|
||||
'name' => 'required|string|max:255',
|
||||
'reference' => 'nullable|string|unique:contracts,reference,' . $contract->id,
|
||||
'provider' => 'required|string',
|
||||
'municipality_id' => 'nullable|exists:municipalities,id',
|
||||
'start_date' => 'required|date',
|
||||
'end_date' => 'nullable|date|after_or_equal:start_date',
|
||||
'amount' => 'nullable|numeric',
|
||||
'status' => 'required|string',
|
||||
]);
|
||||
|
||||
$contract->update($validated);
|
||||
|
||||
// Handle Meta Data Update
|
||||
if ($request->has('meta')) {
|
||||
foreach ($request->meta as $key => $value) {
|
||||
if ($value) {
|
||||
$contract->meta()->updateOrCreate(
|
||||
['key' => $key],
|
||||
['value' => $value]
|
||||
);
|
||||
} else {
|
||||
// If value is empty, maybe delete? Or just leave null.
|
||||
// Let's delete if empty to keep clean
|
||||
$contract->meta()->where('key', $key)->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->route('contracts.index')
|
||||
->with('success', 'Contract updated successfully.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(Contract $contract)
|
||||
{
|
||||
if (!auth()->user()->isAdmin()) { // Only admin can delete? Or manager?
|
||||
abort(403);
|
||||
}
|
||||
|
||||
$contract->delete();
|
||||
|
||||
return redirect()->route('contracts.index')
|
||||
->with('success', 'Contract deleted.');
|
||||
}
|
||||
}
|
||||
8
app/Http/Controllers/Controller.php
Normal file
8
app/Http/Controllers/Controller.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
abstract class Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
32
app/Http/Controllers/CortexXdrController.php
Normal file
32
app/Http/Controllers/CortexXdrController.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Services\CortexXdrService;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CortexXdrController extends Controller
|
||||
{
|
||||
protected $cortex;
|
||||
|
||||
public function __construct(CortexXdrService $cortex)
|
||||
{
|
||||
$this->cortex = $cortex;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
// Return view effectively immediately with a loading state
|
||||
return view('cortex.index');
|
||||
}
|
||||
|
||||
public function getData(CortexXdrService $cortexService)
|
||||
{
|
||||
try {
|
||||
$summary = $cortexService->getSummary();
|
||||
return response()->json($summary);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['error' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
54
app/Http/Controllers/DashboardController.php
Normal file
54
app/Http/Controllers/DashboardController.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Contract;
|
||||
use App\Models\AuditLog;
|
||||
use App\Models\GlobalSetting;
|
||||
use App\Models\Link;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display the dashboard.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$contractStats = [
|
||||
'total' => Contract::count(),
|
||||
'active' => Contract::active()->count(),
|
||||
'expiring_soon' => Contract::expiringSoon(30)->count(),
|
||||
'expired' => Contract::where('status', 'expired')->count(),
|
||||
'by_type' => Contract::select('type', \DB::raw('count(*) as count'))->groupBy('type')->get()->keyBy('type'),
|
||||
];
|
||||
|
||||
// Recent logs
|
||||
$recentLogs = AuditLog::with('user')->latest()->take(10)->get();
|
||||
|
||||
// Upcoming Contracts (Timeline)
|
||||
$upcomingContracts = Contract::whereNotNull('end_date')
|
||||
->whereDate('end_date', '>=', now())
|
||||
->orderBy('end_date', 'asc')
|
||||
->take(6)
|
||||
->get();
|
||||
|
||||
// Dashboard Note
|
||||
$dashboardNote = GlobalSetting::get('dashboard_note');
|
||||
|
||||
// External Links
|
||||
$links = Link::active()->get();
|
||||
|
||||
return view('dashboard', compact('contractStats', 'recentLogs', 'upcomingContracts', 'dashboardNote', 'links'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the dashboard note.
|
||||
*/
|
||||
public function updateNote(Request $request)
|
||||
{
|
||||
GlobalSetting::set('dashboard_note', $request->input('note'));
|
||||
|
||||
return back()->with('success', 'Pense-bête mis à jour.');
|
||||
}
|
||||
}
|
||||
58
app/Http/Controllers/DocumentController.php
Normal file
58
app/Http/Controllers/DocumentController.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Contract;
|
||||
use App\Models\Document;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class DocumentController extends Controller
|
||||
{
|
||||
/**
|
||||
* Store a new document for a contract.
|
||||
*/
|
||||
public function store(Request $request, Contract $contract)
|
||||
{
|
||||
// Simple validation
|
||||
$request->validate([
|
||||
'file' => 'required|file|mimes:pdf,docx,jpg,png|max:10240', // 10MB limit
|
||||
'description' => 'nullable|string|max:255',
|
||||
]);
|
||||
|
||||
if ($request->hasFile('file')) {
|
||||
$path = $request->file('file')->store('contracts/' . $contract->id, 'public');
|
||||
|
||||
$contract->documents()->create([
|
||||
'filename' => $request->file('file')->getClientOriginalName(),
|
||||
'path' => $path,
|
||||
'mime_type' => $request->file('file')->getMimeType(),
|
||||
'size' => $request->file('file')->getSize(),
|
||||
'description' => $request->input('description'),
|
||||
'uploaded_by' => auth()->id(),
|
||||
]);
|
||||
|
||||
return back()->with('success', 'Document uploaded successfully.');
|
||||
}
|
||||
|
||||
return back()->with('error', 'No file uploaded.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a document.
|
||||
*/
|
||||
public function destroy(Document $document)
|
||||
{
|
||||
// Check permission (manager or admin or uploader?)
|
||||
if (!auth()->user()->isManager() && auth()->id() !== $document->uploaded_by) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
// Delete from storage
|
||||
Storage::disk('public')->delete($document->path);
|
||||
|
||||
$document->delete();
|
||||
|
||||
return back()->with('success', 'Document deleted.');
|
||||
}
|
||||
}
|
||||
46
app/Http/Controllers/MunicipalityController.php
Normal file
46
app/Http/Controllers/MunicipalityController.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class MunicipalityController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$municipalities = \App\Models\Municipality::active()->orderBy('name')->get();
|
||||
return view('municipalities.index', compact('municipalities'));
|
||||
}
|
||||
|
||||
public function show(\App\Models\Municipality $municipality)
|
||||
{
|
||||
if (!$municipality->is_active) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$municipality->load(['contracts.meta']);
|
||||
|
||||
$contracts = $municipality->contracts;
|
||||
|
||||
// M365 Statistics
|
||||
$m365Contracts = $contracts->where('type', 'microsoft_365');
|
||||
|
||||
// Fetch all active license levels to initialize stats keys
|
||||
$licenseLevels = \App\Models\LicenseLevel::active()->pluck('name')->toArray();
|
||||
$m365Stats = array_fill_keys($licenseLevels, 0);
|
||||
$m365Stats['Autre'] = 0; // Fallback category
|
||||
|
||||
foreach ($m365Contracts as $contract) {
|
||||
$level = $contract->meta->where('key', 'm365_license_level')->first()?->value;
|
||||
$quantity = (int) $contract->meta->where('key', 'm365_quantity')->first()?->value ?? 0;
|
||||
|
||||
if ($level && array_key_exists($level, $m365Stats)) {
|
||||
$m365Stats[$level] += $quantity;
|
||||
} else {
|
||||
$m365Stats['Autre'] += $quantity;
|
||||
}
|
||||
}
|
||||
|
||||
return view('municipalities.show', compact('municipality', 'contracts', 'm365Stats'));
|
||||
}
|
||||
}
|
||||
25
app/Http/Middleware/EnsureUserIsActive.php
Normal file
25
app/Http/Middleware/EnsureUserIsActive.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class EnsureUserIsActive
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
if (auth()->check() && !auth()->user()->is_active) {
|
||||
auth()->logout();
|
||||
return redirect()->route('login')->withErrors(['email' => 'Your account is pending approval by an administrator.']);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
24
app/Http/Middleware/EnsureUserIsAdmin.php
Normal file
24
app/Http/Middleware/EnsureUserIsAdmin.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class EnsureUserIsAdmin
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
if (!$request->user() || !$request->user()->isAdmin()) {
|
||||
abort(403, 'Unauthorized. Admin access only.');
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
42
app/Mail/ContractExpiringNotification.php
Normal file
42
app/Mail/ContractExpiringNotification.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
class ContractExpiringNotification extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct(
|
||||
public Collection $expiringContracts
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: 'Alertes: Contrats arrivant à échéance',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
public function content(): Content
|
||||
{
|
||||
return new Content(
|
||||
view: 'emails.contracts.expiring',
|
||||
);
|
||||
}
|
||||
}
|
||||
23
app/Models/AuditLog.php
Normal file
23
app/Models/AuditLog.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class AuditLog extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
|
||||
protected $casts = [
|
||||
'changes' => 'array',
|
||||
];
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
60
app/Models/Contract.php
Normal file
60
app/Models/Contract.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Contract extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'reference',
|
||||
'provider',
|
||||
'status',
|
||||
'start_date',
|
||||
'end_date',
|
||||
'amount',
|
||||
'currency',
|
||||
'notes',
|
||||
'type',
|
||||
'municipality_id',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'start_date' => 'date',
|
||||
'end_date' => 'date',
|
||||
'amount' => 'decimal:2',
|
||||
];
|
||||
|
||||
public function meta(): HasMany
|
||||
{
|
||||
return $this->hasMany(ContractMeta::class);
|
||||
}
|
||||
|
||||
public function documents(): HasMany
|
||||
{
|
||||
return $this->hasMany(Document::class);
|
||||
}
|
||||
|
||||
public function municipality(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Municipality::class);
|
||||
}
|
||||
|
||||
// Helpers
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->where('status', 'active');
|
||||
}
|
||||
|
||||
public function scopeExpiringSoon($query, $days = 30)
|
||||
{
|
||||
return $query->where('end_date', '<=', now()->addDays($days))
|
||||
->where('end_date', '>=', now())
|
||||
->where('status', '!=', 'expired');
|
||||
}
|
||||
}
|
||||
25
app/Models/ContractMeta.php
Normal file
25
app/Models/ContractMeta.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class ContractMeta extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'contract_meta'; // singular/plural convention can be tricky if not explicit
|
||||
|
||||
protected $fillable = [
|
||||
'contract_id',
|
||||
'key',
|
||||
'value',
|
||||
];
|
||||
|
||||
public function contract(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Contract::class);
|
||||
}
|
||||
}
|
||||
32
app/Models/Document.php
Normal file
32
app/Models/Document.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Document extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'contract_id',
|
||||
'filename',
|
||||
'path',
|
||||
'mime_type',
|
||||
'size',
|
||||
'description',
|
||||
'uploaded_by',
|
||||
];
|
||||
|
||||
public function contract(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Contract::class);
|
||||
}
|
||||
|
||||
public function uploader(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'uploaded_by');
|
||||
}
|
||||
}
|
||||
30
app/Models/GlobalSetting.php
Normal file
30
app/Models/GlobalSetting.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class GlobalSetting extends Model
|
||||
{
|
||||
protected $fillable = ['key', 'value'];
|
||||
|
||||
/**
|
||||
* Get a global setting value by key.
|
||||
*/
|
||||
public static function get(string $key, $default = null)
|
||||
{
|
||||
$setting = self::where('key', $key)->first();
|
||||
return $setting ? $setting->value : $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a global setting value.
|
||||
*/
|
||||
public static function set(string $key, $value)
|
||||
{
|
||||
return self::updateOrCreate(
|
||||
['key' => $key],
|
||||
['value' => $value]
|
||||
);
|
||||
}
|
||||
}
|
||||
15
app/Models/LicenseLevel.php
Normal file
15
app/Models/LicenseLevel.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class LicenseLevel extends Model
|
||||
{
|
||||
protected $fillable = ['name', 'type', 'is_active'];
|
||||
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->where('is_active', true);
|
||||
}
|
||||
}
|
||||
22
app/Models/Link.php
Normal file
22
app/Models/Link.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Link extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = ['title', 'url', 'icon', 'color', 'order', 'is_active'];
|
||||
|
||||
protected $casts = [
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->where('is_active', true)->orderBy('order', 'asc');
|
||||
}
|
||||
}
|
||||
20
app/Models/Municipality.php
Normal file
20
app/Models/Municipality.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Municipality extends Model
|
||||
{
|
||||
protected $fillable = ['name', 'zip_code', 'is_active'];
|
||||
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->where('is_active', true);
|
||||
}
|
||||
|
||||
public function contracts()
|
||||
{
|
||||
return $this->hasMany(Contract::class);
|
||||
}
|
||||
}
|
||||
66
app/Models/User.php
Normal file
66
app/Models/User.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
||||
use HasFactory, Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
'role',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the attributes that should be cast.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'email_verified_at' => 'datetime',
|
||||
'password' => 'hashed',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
public function isAdmin(): bool
|
||||
{
|
||||
return $this->role === 'admin';
|
||||
}
|
||||
|
||||
public function isManager(): bool
|
||||
{
|
||||
return $this->role === 'manager' || $this->isAdmin();
|
||||
}
|
||||
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->where('is_active', true);
|
||||
}
|
||||
}
|
||||
52
app/Observers/ContractObserver.php
Normal file
52
app/Observers/ContractObserver.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Observers;
|
||||
|
||||
use App\Models\Contract;
|
||||
use App\Models\AuditLog;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class ContractObserver
|
||||
{
|
||||
/**
|
||||
* Handle the Contract "created" event.
|
||||
*/
|
||||
public function created(Contract $contract): void
|
||||
{
|
||||
AuditLog::create([
|
||||
'user_id' => Auth::id(),
|
||||
'action' => 'contract_created',
|
||||
'description' => "Contract {$contract->name} created.",
|
||||
'ip_address' => request()->ip(),
|
||||
'user_agent' => request()->userAgent(),
|
||||
'changes' => $contract->getAttributes(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Contract "updated" event.
|
||||
*/
|
||||
public function updated(Contract $contract): void
|
||||
{
|
||||
AuditLog::create([
|
||||
'user_id' => Auth::id(),
|
||||
'action' => 'contract_updated',
|
||||
'description' => "Contract {$contract->name} updated.",
|
||||
'ip_address' => request()->ip(),
|
||||
'changes' => $contract->getChanges(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Contract "deleted" event.
|
||||
*/
|
||||
public function deleted(Contract $contract): void
|
||||
{
|
||||
AuditLog::create([
|
||||
'user_id' => Auth::id(),
|
||||
'action' => 'contract_deleted',
|
||||
'description' => "Contract {$contract->name} deleted.",
|
||||
'ip_address' => request()->ip(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
66
app/Policies/AuditLogPolicy.php
Normal file
66
app/Policies/AuditLogPolicy.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\AuditLog;
|
||||
use App\Models\User;
|
||||
use Illuminate\Auth\Access\Response;
|
||||
|
||||
class AuditLogPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, AuditLog $auditLog): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, AuditLog $auditLog): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, AuditLog $auditLog): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, AuditLog $auditLog): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, AuditLog $auditLog): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
66
app/Policies/ContractPolicy.php
Normal file
66
app/Policies/ContractPolicy.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\Contract;
|
||||
use App\Models\User;
|
||||
use Illuminate\Auth\Access\Response;
|
||||
|
||||
class ContractPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, Contract $contract): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, Contract $contract): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, Contract $contract): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, Contract $contract): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, Contract $contract): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
65
app/Policies/UserPolicy.php
Normal file
65
app/Policies/UserPolicy.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Auth\Access\Response;
|
||||
|
||||
class UserPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, User $model): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, User $model): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, User $model): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, User $model): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, User $model): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
24
app/Providers/AppServiceProvider.php
Normal file
24
app/Providers/AppServiceProvider.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
171
app/Services/CortexXdrService.php
Normal file
171
app/Services/CortexXdrService.php
Normal file
@@ -0,0 +1,171 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CortexXdrService
|
||||
{
|
||||
protected ?string $apiKey;
|
||||
protected ?string $apiKeyId;
|
||||
protected ?string $baseUrl;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->apiKey = config('services.cortex.key');
|
||||
$this->apiKeyId = config('services.cortex.id');
|
||||
$this->baseUrl = config('services.cortex.url');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate headers.
|
||||
* Switched to Standard Authentication (Direct Key) based on documentation screenshot.
|
||||
*/
|
||||
protected function getHeaders()
|
||||
{
|
||||
// STANDARD AUTHENTICATION
|
||||
return [
|
||||
'x-xdr-auth-id' => $this->apiKeyId,
|
||||
'Authorization' => $this->apiKey,
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Incidents
|
||||
* Using pagination to fetch up to $limit incidents.
|
||||
*/
|
||||
public function getIncidents($limit = 1000)
|
||||
{
|
||||
return $this->fetchAll('incidents/get_incidents', 'incidents', $limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Endpoints
|
||||
* Using pagination to fetch up to $limit endpoints.
|
||||
*/
|
||||
public function getEndpoints($limit = 1000)
|
||||
{
|
||||
return $this->fetchAll('endpoints/get_endpoint', 'endpoints', $limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic fetch method with pagination.
|
||||
*/
|
||||
private function fetchAll($endpoint, $dataKey, $limit)
|
||||
{
|
||||
if (empty($this->apiKey) || empty($this->apiKeyId) || empty($this->baseUrl)) {
|
||||
Log::warning('Cortex XDR credentials missing.');
|
||||
return [];
|
||||
}
|
||||
|
||||
$allResults = [];
|
||||
$batchSize = 100; // API Limit
|
||||
$offset = 0;
|
||||
|
||||
try {
|
||||
while ($offset < $limit) {
|
||||
// Adjust batch size for last page if needed
|
||||
$currentBatchSize = min($batchSize, $limit - $offset);
|
||||
|
||||
// API confusingly uses search_to as count? Or offset + count?
|
||||
// Documentation: "search_to: Integer representing the ending offset" ?
|
||||
// Error message: "0 < search_size <= 100".
|
||||
// Wait, request_data documentation usually says:
|
||||
// search_from: integer
|
||||
// search_to: integer (exclusive end index?) or count?
|
||||
// Let's assume standard Cortex: offset based.
|
||||
// If search_from=0, search_to=100 -> gets 0 to 99 (100 items).
|
||||
|
||||
$response = Http::withHeaders($this->getHeaders())
|
||||
->post("{$this->baseUrl}/public_api/v1/{$endpoint}/", [
|
||||
'request_data' => [
|
||||
'search_from' => $offset,
|
||||
'search_to' => $offset + $currentBatchSize,
|
||||
]
|
||||
]);
|
||||
|
||||
if ($response->successful()) {
|
||||
$items = $response->json()['reply'][$dataKey] ?? [];
|
||||
|
||||
if (empty($items)) {
|
||||
break; // No more items
|
||||
}
|
||||
|
||||
$allResults = array_merge($allResults, $items);
|
||||
$offset += count($items);
|
||||
|
||||
// If we got fewer items than requested, we are done
|
||||
if (count($items) < $currentBatchSize) {
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
$err = "Cortex API Error ({$endpoint}): " . $response->status() . ' - ' . $response->body();
|
||||
Log::error($err);
|
||||
throw new \Exception($err);
|
||||
}
|
||||
}
|
||||
|
||||
return $allResults;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Dashboard Summary
|
||||
*/
|
||||
public function getSummary()
|
||||
{
|
||||
try {
|
||||
$incidents = $this->getIncidents(1000); // Limit incidents to 1000 recent
|
||||
$endpoints = $this->getEndpoints(1000); // Limit endpoints to 2000
|
||||
} catch (\Exception $e) {
|
||||
// In dashboard context, we verify configuration separately.
|
||||
// Returning empty arrays here avoids crashing the page if just one call fails.
|
||||
$incidents = [];
|
||||
$endpoints = [];
|
||||
}
|
||||
|
||||
// Calculations
|
||||
$endpointsTotal = count($endpoints);
|
||||
$endpointsConnected = collect($endpoints)->filter(fn($e) => strtolower($e['endpoint_status'] ?? '') === 'connected')->count();
|
||||
$endpointsDisconnected = collect($endpoints)->filter(fn($e) => strtolower($e['endpoint_status'] ?? '') === 'disconnected')->count();
|
||||
|
||||
// Filter only Active Incidents (New or Under Investigation)
|
||||
$activeIncidents = collect($incidents)->filter(fn($i) => in_array($i['status'] ?? '', ['new', 'under_investigation']));
|
||||
|
||||
//die(var_dump($activeIncidents));
|
||||
|
||||
$incidentsCritical = $activeIncidents->where('severity', 'critical')->count();
|
||||
$incidentsHigh = $activeIncidents->where('severity', 'high')->count();
|
||||
$incidentsMedium = $activeIncidents->where('severity', 'medium')->count();
|
||||
$incidentsLow = $activeIncidents->where('severity', 'low')->count();
|
||||
|
||||
// Endpoint Types (Workstation, Server, etc.)
|
||||
$endpointTypes = collect($endpoints)->groupBy(function ($e) {
|
||||
return ucfirst(strtolower($e['endpoint_type'] ?? 'Unknown'));
|
||||
})->map->count();
|
||||
|
||||
return [
|
||||
'incidents_total' => $activeIncidents->count(),
|
||||
'incidents_critical' => $incidentsCritical,
|
||||
'incidents_high' => $incidentsHigh,
|
||||
'incidents_medium' => $incidentsMedium,
|
||||
'incidents_low' => $incidentsLow,
|
||||
'endpoints_total' => $endpointsTotal,
|
||||
'endpoints_connected' => $endpointsConnected,
|
||||
'endpoints_disconnected' => $endpointsDisconnected,
|
||||
'endpoints_types' => $endpointTypes, // New Data
|
||||
'recent_incidents' => collect($incidents)
|
||||
->filter(fn($i) => !in_array($i['status'] ?? '', ['resolved_true_positive', 'resolved_false_positive']))
|
||||
->slice(0, 10)
|
||||
->values()
|
||||
->all()
|
||||
];
|
||||
}
|
||||
}
|
||||
18
artisan
Normal file
18
artisan
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Application;
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
// Register the Composer autoloader...
|
||||
require __DIR__.'/vendor/autoload.php';
|
||||
|
||||
// Bootstrap Laravel and handle the command...
|
||||
/** @var Application $app */
|
||||
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||
|
||||
$status = $app->handleCommand(new ArgvInput);
|
||||
|
||||
exit($status);
|
||||
21
bootstrap/app.php
Normal file
21
bootstrap/app.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Foundation\Configuration\Exceptions;
|
||||
use Illuminate\Foundation\Configuration\Middleware;
|
||||
|
||||
return Application::configure(basePath: dirname(__DIR__))
|
||||
->withRouting(
|
||||
web: __DIR__.'/../routes/web.php',
|
||||
commands: __DIR__.'/../routes/console.php',
|
||||
health: '/up',
|
||||
)
|
||||
->withMiddleware(function (Middleware $middleware): void {
|
||||
$middleware->alias([
|
||||
'active' => \App\Http\Middleware\EnsureUserIsActive::class,
|
||||
'admin' => \App\Http\Middleware\EnsureUserIsAdmin::class,
|
||||
]);
|
||||
})
|
||||
->withExceptions(function (Exceptions $exceptions): void {
|
||||
//
|
||||
})->create();
|
||||
2
bootstrap/cache/.gitignore
vendored
Normal file
2
bootstrap/cache/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
5
bootstrap/providers.php
Normal file
5
bootstrap/providers.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
App\Providers\AppServiceProvider::class,
|
||||
];
|
||||
86
composer.json
Normal file
86
composer.json
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"$schema": "https://getcomposer.org/schema.json",
|
||||
"name": "laravel/laravel",
|
||||
"type": "project",
|
||||
"description": "The skeleton application for the Laravel framework.",
|
||||
"keywords": ["laravel", "framework"],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.2",
|
||||
"laravel/framework": "^12.0",
|
||||
"laravel/tinker": "^2.10.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.23",
|
||||
"laravel/pail": "^1.2.2",
|
||||
"laravel/pint": "^1.24",
|
||||
"laravel/sail": "^1.41",
|
||||
"mockery/mockery": "^1.6",
|
||||
"nunomaduro/collision": "^8.6",
|
||||
"phpunit/phpunit": "^11.5.3"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"setup": [
|
||||
"composer install",
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"",
|
||||
"@php artisan key:generate",
|
||||
"@php artisan migrate --force",
|
||||
"npm install",
|
||||
"npm run build"
|
||||
],
|
||||
"dev": [
|
||||
"Composer\\Config::disableProcessTimeout",
|
||||
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1 --timeout=0\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite --kill-others"
|
||||
],
|
||||
"test": [
|
||||
"@php artisan config:clear --ansi",
|
||||
"@php artisan test"
|
||||
],
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover --ansi"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||
],
|
||||
"post-root-package-install": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
],
|
||||
"post-create-project-cmd": [
|
||||
"@php artisan key:generate --ansi",
|
||||
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
|
||||
"@php artisan migrate --graceful --ansi"
|
||||
],
|
||||
"pre-package-uninstall": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::prePackageUninstall"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"dont-discover": []
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"pestphp/pest-plugin": true,
|
||||
"php-http/discovery": true
|
||||
}
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true
|
||||
}
|
||||
8396
composer.lock
generated
Normal file
8396
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
126
config/app.php
Normal file
126
config/app.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value is the name of your application, which will be used when the
|
||||
| framework needs to place the application's name in a notification or
|
||||
| other UI elements where an application name needs to be displayed.
|
||||
|
|
||||
*/
|
||||
|
||||
'name' => env('APP_NAME', 'Laravel'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Environment
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the "environment" your application is currently
|
||||
| running in. This may determine how you prefer to configure various
|
||||
| services the application utilizes. Set this in your ".env" file.
|
||||
|
|
||||
*/
|
||||
|
||||
'env' => env('APP_ENV', 'production'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Debug Mode
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When your application is in debug mode, detailed error messages with
|
||||
| stack traces will be shown on every error that occurs within your
|
||||
| application. If disabled, a simple generic error page is shown.
|
||||
|
|
||||
*/
|
||||
|
||||
'debug' => (bool) env('APP_DEBUG', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This URL is used by the console to properly generate URLs when using
|
||||
| the Artisan command line tool. You should set this to the root of
|
||||
| the application so that it's available within Artisan commands.
|
||||
|
|
||||
*/
|
||||
|
||||
'url' => env('APP_URL', 'http://localhost'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Timezone
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default timezone for your application, which
|
||||
| will be used by the PHP date and date-time functions. The timezone
|
||||
| is set to "UTC" by default as it is suitable for most use cases.
|
||||
|
|
||||
*/
|
||||
|
||||
'timezone' => 'UTC',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Locale Configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The application locale determines the default locale that will be used
|
||||
| by Laravel's translation / localization methods. This option can be
|
||||
| set to any locale for which you plan to have translation strings.
|
||||
|
|
||||
*/
|
||||
|
||||
'locale' => env('APP_LOCALE', 'en'),
|
||||
|
||||
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
|
||||
|
||||
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Encryption Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This key is utilized by Laravel's encryption services and should be set
|
||||
| to a random, 32 character string to ensure that all encrypted values
|
||||
| are secure. You should do this prior to deploying the application.
|
||||
|
|
||||
*/
|
||||
|
||||
'cipher' => 'AES-256-CBC',
|
||||
|
||||
'key' => env('APP_KEY'),
|
||||
|
||||
'previous_keys' => [
|
||||
...array_filter(
|
||||
explode(',', (string) env('APP_PREVIOUS_KEYS', ''))
|
||||
),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Maintenance Mode Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These configuration options determine the driver used to determine and
|
||||
| manage Laravel's "maintenance mode" status. The "cache" driver will
|
||||
| allow maintenance mode to be controlled across multiple machines.
|
||||
|
|
||||
| Supported drivers: "file", "cache"
|
||||
|
|
||||
*/
|
||||
|
||||
'maintenance' => [
|
||||
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
|
||||
'store' => env('APP_MAINTENANCE_STORE', 'database'),
|
||||
],
|
||||
|
||||
];
|
||||
115
config/auth.php
Normal file
115
config/auth.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Defaults
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default authentication "guard" and password
|
||||
| reset "broker" for your application. You may change these values
|
||||
| as required, but they're a perfect start for most applications.
|
||||
|
|
||||
*/
|
||||
|
||||
'defaults' => [
|
||||
'guard' => env('AUTH_GUARD', 'web'),
|
||||
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Guards
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Next, you may define every authentication guard for your application.
|
||||
| Of course, a great default configuration has been defined for you
|
||||
| which utilizes session storage plus the Eloquent user provider.
|
||||
|
|
||||
| All authentication guards have a user provider, which defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| system used by the application. Typically, Eloquent is utilized.
|
||||
|
|
||||
| Supported: "session"
|
||||
|
|
||||
*/
|
||||
|
||||
'guards' => [
|
||||
'web' => [
|
||||
'driver' => 'session',
|
||||
'provider' => 'users',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| User Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| All authentication guards have a user provider, which defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| system used by the application. Typically, Eloquent is utilized.
|
||||
|
|
||||
| If you have multiple user tables or models you may configure multiple
|
||||
| providers to represent the model / table. These providers may then
|
||||
| be assigned to any extra authentication guards you have defined.
|
||||
|
|
||||
| Supported: "database", "eloquent"
|
||||
|
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
'users' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => env('AUTH_MODEL', App\Models\User::class),
|
||||
],
|
||||
|
||||
// 'users' => [
|
||||
// 'driver' => 'database',
|
||||
// 'table' => 'users',
|
||||
// ],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Resetting Passwords
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These configuration options specify the behavior of Laravel's password
|
||||
| reset functionality, including the table utilized for token storage
|
||||
| and the user provider that is invoked to actually retrieve users.
|
||||
|
|
||||
| The expiry time is the number of minutes that each reset token will be
|
||||
| considered valid. This security feature keeps tokens short-lived so
|
||||
| they have less time to be guessed. You may change this as needed.
|
||||
|
|
||||
| The throttle setting is the number of seconds a user must wait before
|
||||
| generating more password reset tokens. This prevents the user from
|
||||
| quickly generating a very large amount of password reset tokens.
|
||||
|
|
||||
*/
|
||||
|
||||
'passwords' => [
|
||||
'users' => [
|
||||
'provider' => 'users',
|
||||
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
|
||||
'expire' => 60,
|
||||
'throttle' => 60,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Confirmation Timeout
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define the number of seconds before a password confirmation
|
||||
| window expires and users are asked to re-enter their password via the
|
||||
| confirmation screen. By default, the timeout lasts for three hours.
|
||||
|
|
||||
*/
|
||||
|
||||
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
|
||||
|
||||
];
|
||||
117
config/cache.php
Normal file
117
config/cache.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default cache store that will be used by the
|
||||
| framework. This connection is utilized if another isn't explicitly
|
||||
| specified when running a cache operation inside the application.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('CACHE_STORE', 'database'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Stores
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the cache "stores" for your application as
|
||||
| well as their drivers. You may even define multiple stores for the
|
||||
| same cache driver to group types of items stored in your caches.
|
||||
|
|
||||
| Supported drivers: "array", "database", "file", "memcached",
|
||||
| "redis", "dynamodb", "octane",
|
||||
| "failover", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'stores' => [
|
||||
|
||||
'array' => [
|
||||
'driver' => 'array',
|
||||
'serialize' => false,
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'connection' => env('DB_CACHE_CONNECTION'),
|
||||
'table' => env('DB_CACHE_TABLE', 'cache'),
|
||||
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
|
||||
'lock_table' => env('DB_CACHE_LOCK_TABLE'),
|
||||
],
|
||||
|
||||
'file' => [
|
||||
'driver' => 'file',
|
||||
'path' => storage_path('framework/cache/data'),
|
||||
'lock_path' => storage_path('framework/cache/data'),
|
||||
],
|
||||
|
||||
'memcached' => [
|
||||
'driver' => 'memcached',
|
||||
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
|
||||
'sasl' => [
|
||||
env('MEMCACHED_USERNAME'),
|
||||
env('MEMCACHED_PASSWORD'),
|
||||
],
|
||||
'options' => [
|
||||
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
|
||||
],
|
||||
'servers' => [
|
||||
[
|
||||
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
||||
'port' => env('MEMCACHED_PORT', 11211),
|
||||
'weight' => 100,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
|
||||
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
|
||||
],
|
||||
|
||||
'dynamodb' => [
|
||||
'driver' => 'dynamodb',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
|
||||
'endpoint' => env('DYNAMODB_ENDPOINT'),
|
||||
],
|
||||
|
||||
'octane' => [
|
||||
'driver' => 'octane',
|
||||
],
|
||||
|
||||
'failover' => [
|
||||
'driver' => 'failover',
|
||||
'stores' => [
|
||||
'database',
|
||||
'array',
|
||||
],
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Key Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
|
||||
| stores, there might be other applications using the same cache. For
|
||||
| that reason, you may prefix every cache key to avoid collisions.
|
||||
|
|
||||
*/
|
||||
|
||||
'prefix' => env('CACHE_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-cache-'),
|
||||
|
||||
];
|
||||
183
config/database.php
Normal file
183
config/database.php
Normal file
@@ -0,0 +1,183 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Database Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify which of the database connections below you wish
|
||||
| to use as your default connection for database operations. This is
|
||||
| the connection which will be utilized unless another connection
|
||||
| is explicitly specified when you execute a query / statement.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('DB_CONNECTION', 'sqlite'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Database Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Below are all of the database connections defined for your application.
|
||||
| An example configuration is provided for each database system which
|
||||
| is supported by Laravel. You're free to add / remove connections.
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sqlite' => [
|
||||
'driver' => 'sqlite',
|
||||
'url' => env('DB_URL'),
|
||||
'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
||||
'prefix' => '',
|
||||
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
||||
'busy_timeout' => null,
|
||||
'journal_mode' => null,
|
||||
'synchronous' => null,
|
||||
'transaction_mode' => 'DEFERRED',
|
||||
],
|
||||
|
||||
'mysql' => [
|
||||
'driver' => 'mysql',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'unix_socket' => env('DB_SOCKET', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8mb4'),
|
||||
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
(PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'mariadb' => [
|
||||
'driver' => 'mariadb',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'unix_socket' => env('DB_SOCKET', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8mb4'),
|
||||
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
(PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'pgsql' => [
|
||||
'driver' => 'pgsql',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '5432'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'search_path' => 'public',
|
||||
'sslmode' => env('DB_SSLMODE', 'prefer'),
|
||||
],
|
||||
|
||||
'sqlsrv' => [
|
||||
'driver' => 'sqlsrv',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', 'localhost'),
|
||||
'port' => env('DB_PORT', '1433'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
|
||||
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migration Repository Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This table keeps track of all the migrations that have already run for
|
||||
| your application. Using this information, we can determine which of
|
||||
| the migrations on disk haven't actually been run on the database.
|
||||
|
|
||||
*/
|
||||
|
||||
'migrations' => [
|
||||
'table' => 'migrations',
|
||||
'update_date_on_publish' => true,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Redis Databases
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Redis is an open source, fast, and advanced key-value store that also
|
||||
| provides a richer body of commands than a typical key-value system
|
||||
| such as Memcached. You may define your connection settings here.
|
||||
|
|
||||
*/
|
||||
|
||||
'redis' => [
|
||||
|
||||
'client' => env('REDIS_CLIENT', 'phpredis'),
|
||||
|
||||
'options' => [
|
||||
'cluster' => env('REDIS_CLUSTER', 'redis'),
|
||||
'prefix' => env('REDIS_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-database-'),
|
||||
'persistent' => env('REDIS_PERSISTENT', false),
|
||||
],
|
||||
|
||||
'default' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_DB', '0'),
|
||||
'max_retries' => env('REDIS_MAX_RETRIES', 3),
|
||||
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
|
||||
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
|
||||
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
|
||||
],
|
||||
|
||||
'cache' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_CACHE_DB', '1'),
|
||||
'max_retries' => env('REDIS_MAX_RETRIES', 3),
|
||||
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
|
||||
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
|
||||
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
80
config/filesystems.php
Normal file
80
config/filesystems.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Filesystem Disk
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default filesystem disk that should be used
|
||||
| by the framework. The "local" disk, as well as a variety of cloud
|
||||
| based disks are available to your application for file storage.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('FILESYSTEM_DISK', 'local'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Filesystem Disks
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Below you may configure as many filesystem disks as necessary, and you
|
||||
| may even configure multiple disks for the same driver. Examples for
|
||||
| most supported storage drivers are configured here for reference.
|
||||
|
|
||||
| Supported drivers: "local", "ftp", "sftp", "s3"
|
||||
|
|
||||
*/
|
||||
|
||||
'disks' => [
|
||||
|
||||
'local' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/private'),
|
||||
'serve' => true,
|
||||
'throw' => false,
|
||||
'report' => false,
|
||||
],
|
||||
|
||||
'public' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/public'),
|
||||
'url' => rtrim(env('APP_URL', 'http://localhost'), '/').'/storage',
|
||||
'visibility' => 'public',
|
||||
'throw' => false,
|
||||
'report' => false,
|
||||
],
|
||||
|
||||
's3' => [
|
||||
'driver' => 's3',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION'),
|
||||
'bucket' => env('AWS_BUCKET'),
|
||||
'url' => env('AWS_URL'),
|
||||
'endpoint' => env('AWS_ENDPOINT'),
|
||||
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
||||
'throw' => false,
|
||||
'report' => false,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Symbolic Links
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the symbolic links that will be created when the
|
||||
| `storage:link` Artisan command is executed. The array keys should be
|
||||
| the locations of the links and the values should be their targets.
|
||||
|
|
||||
*/
|
||||
|
||||
'links' => [
|
||||
public_path('storage') => storage_path('app/public'),
|
||||
],
|
||||
|
||||
];
|
||||
132
config/logging.php
Normal file
132
config/logging.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
use Monolog\Handler\NullHandler;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Handler\SyslogUdpHandler;
|
||||
use Monolog\Processor\PsrLogMessageProcessor;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default log channel that is utilized to write
|
||||
| messages to your logs. The value provided here should match one of
|
||||
| the channels present in the list of "channels" configured below.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('LOG_CHANNEL', 'stack'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Deprecations Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the log channel that should be used to log warnings
|
||||
| regarding deprecated PHP and library features. This allows you to get
|
||||
| your application ready for upcoming major versions of dependencies.
|
||||
|
|
||||
*/
|
||||
|
||||
'deprecations' => [
|
||||
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
|
||||
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log Channels
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the log channels for your application. Laravel
|
||||
| utilizes the Monolog PHP logging library, which includes a variety
|
||||
| of powerful log handlers and formatters that you're free to use.
|
||||
|
|
||||
| Available drivers: "single", "daily", "slack", "syslog",
|
||||
| "errorlog", "monolog", "custom", "stack"
|
||||
|
|
||||
*/
|
||||
|
||||
'channels' => [
|
||||
|
||||
'stack' => [
|
||||
'driver' => 'stack',
|
||||
'channels' => explode(',', (string) env('LOG_STACK', 'single')),
|
||||
'ignore_exceptions' => false,
|
||||
],
|
||||
|
||||
'single' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'daily' => [
|
||||
'driver' => 'daily',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'days' => env('LOG_DAILY_DAYS', 14),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'driver' => 'slack',
|
||||
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||
'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'),
|
||||
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
|
||||
'level' => env('LOG_LEVEL', 'critical'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'papertrail' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
|
||||
'handler_with' => [
|
||||
'host' => env('PAPERTRAIL_URL'),
|
||||
'port' => env('PAPERTRAIL_PORT'),
|
||||
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
|
||||
],
|
||||
'processors' => [PsrLogMessageProcessor::class],
|
||||
],
|
||||
|
||||
'stderr' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => StreamHandler::class,
|
||||
'handler_with' => [
|
||||
'stream' => 'php://stderr',
|
||||
],
|
||||
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||
'processors' => [PsrLogMessageProcessor::class],
|
||||
],
|
||||
|
||||
'syslog' => [
|
||||
'driver' => 'syslog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'errorlog' => [
|
||||
'driver' => 'errorlog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => NullHandler::class,
|
||||
],
|
||||
|
||||
'emergency' => [
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
118
config/mail.php
Normal file
118
config/mail.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Mailer
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default mailer that is used to send all email
|
||||
| messages unless another mailer is explicitly specified when sending
|
||||
| the message. All additional mailers can be configured within the
|
||||
| "mailers" array. Examples of each type of mailer are provided.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('MAIL_MAILER', 'log'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mailer Configurations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure all of the mailers used by your application plus
|
||||
| their respective settings. Several examples have been configured for
|
||||
| you and you are free to add your own as your application requires.
|
||||
|
|
||||
| Laravel supports a variety of mail "transport" drivers that can be used
|
||||
| when delivering an email. You may specify which one you're using for
|
||||
| your mailers below. You may also add additional mailers if needed.
|
||||
|
|
||||
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
|
||||
| "postmark", "resend", "log", "array",
|
||||
| "failover", "roundrobin"
|
||||
|
|
||||
*/
|
||||
|
||||
'mailers' => [
|
||||
|
||||
'smtp' => [
|
||||
'transport' => 'smtp',
|
||||
'scheme' => env('MAIL_SCHEME'),
|
||||
'url' => env('MAIL_URL'),
|
||||
'host' => env('MAIL_HOST', '127.0.0.1'),
|
||||
'port' => env('MAIL_PORT', 2525),
|
||||
'username' => env('MAIL_USERNAME'),
|
||||
'password' => env('MAIL_PASSWORD'),
|
||||
'timeout' => null,
|
||||
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url((string) env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'transport' => 'ses',
|
||||
],
|
||||
|
||||
'postmark' => [
|
||||
'transport' => 'postmark',
|
||||
// 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'),
|
||||
// 'client' => [
|
||||
// 'timeout' => 5,
|
||||
// ],
|
||||
],
|
||||
|
||||
'resend' => [
|
||||
'transport' => 'resend',
|
||||
],
|
||||
|
||||
'sendmail' => [
|
||||
'transport' => 'sendmail',
|
||||
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
|
||||
],
|
||||
|
||||
'log' => [
|
||||
'transport' => 'log',
|
||||
'channel' => env('MAIL_LOG_CHANNEL'),
|
||||
],
|
||||
|
||||
'array' => [
|
||||
'transport' => 'array',
|
||||
],
|
||||
|
||||
'failover' => [
|
||||
'transport' => 'failover',
|
||||
'mailers' => [
|
||||
'smtp',
|
||||
'log',
|
||||
],
|
||||
'retry_after' => 60,
|
||||
],
|
||||
|
||||
'roundrobin' => [
|
||||
'transport' => 'roundrobin',
|
||||
'mailers' => [
|
||||
'ses',
|
||||
'postmark',
|
||||
],
|
||||
'retry_after' => 60,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global "From" Address
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may wish for all emails sent by your application to be sent from
|
||||
| the same address. Here you may specify a name and address that is
|
||||
| used globally for all emails that are sent by your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||
],
|
||||
|
||||
];
|
||||
129
config/queue.php
Normal file
129
config/queue.php
Normal file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Queue Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Laravel's queue supports a variety of backends via a single, unified
|
||||
| API, giving you convenient access to each backend using identical
|
||||
| syntax for each. The default queue connection is defined below.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('QUEUE_CONNECTION', 'database'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Queue Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the connection options for every queue backend
|
||||
| used by your application. An example configuration is provided for
|
||||
| each backend supported by Laravel. You're also free to add more.
|
||||
|
|
||||
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis",
|
||||
| "deferred", "background", "failover", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sync' => [
|
||||
'driver' => 'sync',
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'connection' => env('DB_QUEUE_CONNECTION'),
|
||||
'table' => env('DB_QUEUE_TABLE', 'jobs'),
|
||||
'queue' => env('DB_QUEUE', 'default'),
|
||||
'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90),
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'beanstalkd' => [
|
||||
'driver' => 'beanstalkd',
|
||||
'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'),
|
||||
'queue' => env('BEANSTALKD_QUEUE', 'default'),
|
||||
'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90),
|
||||
'block_for' => 0,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'sqs' => [
|
||||
'driver' => 'sqs',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
|
||||
'queue' => env('SQS_QUEUE', 'default'),
|
||||
'suffix' => env('SQS_SUFFIX'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
|
||||
'queue' => env('REDIS_QUEUE', 'default'),
|
||||
'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90),
|
||||
'block_for' => null,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'deferred' => [
|
||||
'driver' => 'deferred',
|
||||
],
|
||||
|
||||
'background' => [
|
||||
'driver' => 'background',
|
||||
],
|
||||
|
||||
'failover' => [
|
||||
'driver' => 'failover',
|
||||
'connections' => [
|
||||
'database',
|
||||
'deferred',
|
||||
],
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Job Batching
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following options configure the database and table that store job
|
||||
| batching information. These options can be updated to any database
|
||||
| connection and table which has been defined by your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'batching' => [
|
||||
'database' => env('DB_CONNECTION', 'sqlite'),
|
||||
'table' => 'job_batches',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Failed Queue Jobs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These options configure the behavior of failed queue job logging so you
|
||||
| can control how and where failed jobs are stored. Laravel ships with
|
||||
| support for storing failed jobs in a simple file or in a database.
|
||||
|
|
||||
| Supported drivers: "database-uuids", "dynamodb", "file", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'failed' => [
|
||||
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
|
||||
'database' => env('DB_CONNECTION', 'sqlite'),
|
||||
'table' => 'failed_jobs',
|
||||
],
|
||||
|
||||
];
|
||||
44
config/services.php
Normal file
44
config/services.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Third Party Services
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This file is for storing the credentials for third party services such
|
||||
| as Mailgun, Postmark, AWS and more. This file provides the de facto
|
||||
| location for this type of information, allowing packages to have
|
||||
| a conventional file to locate the various service credentials.
|
||||
|
|
||||
*/
|
||||
|
||||
'postmark' => [
|
||||
'key' => env('POSTMARK_API_KEY'),
|
||||
],
|
||||
|
||||
'resend' => [
|
||||
'key' => env('RESEND_API_KEY'),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'notifications' => [
|
||||
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
|
||||
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
|
||||
],
|
||||
],
|
||||
|
||||
'cortex' => [
|
||||
'key' => env('CORTEX_XDR_API_KEY'),
|
||||
'id' => env('CORTEX_XDR_API_KEY_ID'),
|
||||
'url' => env('CORTEX_XDR_BASE_URL'),
|
||||
],
|
||||
|
||||
];
|
||||
217
config/session.php
Normal file
217
config/session.php
Normal file
@@ -0,0 +1,217 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Session Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines the default session driver that is utilized for
|
||||
| incoming requests. Laravel supports a variety of storage options to
|
||||
| persist session data. Database storage is a great default choice.
|
||||
|
|
||||
| Supported: "file", "cookie", "database", "memcached",
|
||||
| "redis", "dynamodb", "array"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => env('SESSION_DRIVER', 'database'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Lifetime
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the number of minutes that you wish the session
|
||||
| to be allowed to remain idle before it expires. If you want them
|
||||
| to expire immediately when the browser is closed then you may
|
||||
| indicate that via the expire_on_close configuration option.
|
||||
|
|
||||
*/
|
||||
|
||||
'lifetime' => (int) env('SESSION_LIFETIME', 120),
|
||||
|
||||
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Encryption
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option allows you to easily specify that all of your session data
|
||||
| should be encrypted before it's stored. All encryption is performed
|
||||
| automatically by Laravel and you may use the session like normal.
|
||||
|
|
||||
*/
|
||||
|
||||
'encrypt' => env('SESSION_ENCRYPT', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session File Location
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When utilizing the "file" session driver, the session files are placed
|
||||
| on disk. The default storage location is defined here; however, you
|
||||
| are free to provide another location where they should be stored.
|
||||
|
|
||||
*/
|
||||
|
||||
'files' => storage_path('framework/sessions'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Connection
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" or "redis" session drivers, you may specify a
|
||||
| connection that should be used to manage these sessions. This should
|
||||
| correspond to a connection in your database configuration options.
|
||||
|
|
||||
*/
|
||||
|
||||
'connection' => env('SESSION_CONNECTION'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" session driver, you may specify the table to
|
||||
| be used to store sessions. Of course, a sensible default is defined
|
||||
| for you; however, you're welcome to change this to another table.
|
||||
|
|
||||
*/
|
||||
|
||||
'table' => env('SESSION_TABLE', 'sessions'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using one of the framework's cache driven session backends, you may
|
||||
| define the cache store which should be used to store the session data
|
||||
| between requests. This must match one of your defined cache stores.
|
||||
|
|
||||
| Affects: "dynamodb", "memcached", "redis"
|
||||
|
|
||||
*/
|
||||
|
||||
'store' => env('SESSION_STORE'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Sweeping Lottery
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Some session drivers must manually sweep their storage location to get
|
||||
| rid of old sessions from storage. Here are the chances that it will
|
||||
| happen on a given request. By default, the odds are 2 out of 100.
|
||||
|
|
||||
*/
|
||||
|
||||
'lottery' => [2, 100],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may change the name of the session cookie that is created by
|
||||
| the framework. Typically, you should not need to change this value
|
||||
| since doing so does not grant a meaningful security improvement.
|
||||
|
|
||||
*/
|
||||
|
||||
'cookie' => env(
|
||||
'SESSION_COOKIE',
|
||||
Str::slug((string) env('APP_NAME', 'laravel')).'-session'
|
||||
),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The session cookie path determines the path for which the cookie will
|
||||
| be regarded as available. Typically, this will be the root path of
|
||||
| your application, but you're free to change this when necessary.
|
||||
|
|
||||
*/
|
||||
|
||||
'path' => env('SESSION_PATH', '/'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Domain
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the domain and subdomains the session cookie is
|
||||
| available to. By default, the cookie will be available to the root
|
||||
| domain without subdomains. Typically, this shouldn't be changed.
|
||||
|
|
||||
*/
|
||||
|
||||
'domain' => env('SESSION_DOMAIN'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTPS Only Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By setting this option to true, session cookies will only be sent back
|
||||
| to the server if the browser has a HTTPS connection. This will keep
|
||||
| the cookie from being sent to you when it can't be done securely.
|
||||
|
|
||||
*/
|
||||
|
||||
'secure' => env('SESSION_SECURE_COOKIE'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTP Access Only
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Setting this value to true will prevent JavaScript from accessing the
|
||||
| value of the cookie and the cookie will only be accessible through
|
||||
| the HTTP protocol. It's unlikely you should disable this option.
|
||||
|
|
||||
*/
|
||||
|
||||
'http_only' => env('SESSION_HTTP_ONLY', true),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Same-Site Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines how your cookies behave when cross-site requests
|
||||
| take place, and can be used to mitigate CSRF attacks. By default, we
|
||||
| will set this value to "lax" to permit secure cross-site requests.
|
||||
|
|
||||
| See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
|
||||
|
|
||||
| Supported: "lax", "strict", "none", null
|
||||
|
|
||||
*/
|
||||
|
||||
'same_site' => env('SESSION_SAME_SITE', 'lax'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Partitioned Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Setting this value to true will tie the cookie to the top-level site for
|
||||
| a cross-site context. Partitioned cookies are accepted by the browser
|
||||
| when flagged "secure" and the Same-Site attribute is set to "none".
|
||||
|
|
||||
*/
|
||||
|
||||
'partitioned' => env('SESSION_PARTITIONED_COOKIE', false),
|
||||
|
||||
];
|
||||
1
database/.gitignore
vendored
Normal file
1
database/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.sqlite*
|
||||
44
database/factories/UserFactory.php
Normal file
44
database/factories/UserFactory.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The current password being used by the factory.
|
||||
*/
|
||||
protected static ?string $password;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->name(),
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => static::$password ??= Hash::make('password'),
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*/
|
||||
public function unverified(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
51
database/migrations/0001_01_01_000000_create_users_table.php
Normal file
51
database/migrations/0001_01_01_000000_create_users_table.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->string('role')->default('reader'); // admin, manager, reader
|
||||
$table->boolean('is_active')->default(false);
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
||||
$table->string('email')->primary();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('sessions', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->foreignId('user_id')->nullable()->index();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->longText('payload');
|
||||
$table->integer('last_activity')->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
Schema::dropIfExists('password_reset_tokens');
|
||||
Schema::dropIfExists('sessions');
|
||||
}
|
||||
};
|
||||
35
database/migrations/0001_01_01_000001_create_cache_table.php
Normal file
35
database/migrations/0001_01_01_000001_create_cache_table.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('cache', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->mediumText('value');
|
||||
$table->integer('expiration')->index();
|
||||
});
|
||||
|
||||
Schema::create('cache_locks', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->string('owner');
|
||||
$table->integer('expiration')->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cache');
|
||||
Schema::dropIfExists('cache_locks');
|
||||
}
|
||||
};
|
||||
57
database/migrations/0001_01_01_000002_create_jobs_table.php
Normal file
57
database/migrations/0001_01_01_000002_create_jobs_table.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
|
||||
Schema::create('job_batches', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->string('name');
|
||||
$table->integer('total_jobs');
|
||||
$table->integer('pending_jobs');
|
||||
$table->integer('failed_jobs');
|
||||
$table->longText('failed_job_ids');
|
||||
$table->mediumText('options')->nullable();
|
||||
$table->integer('cancelled_at')->nullable();
|
||||
$table->integer('created_at');
|
||||
$table->integer('finished_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
Schema::dropIfExists('job_batches');
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('contracts', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('reference')->unique()->nullable();
|
||||
$table->string('provider');
|
||||
$table->string('status')->default('draft'); // active, expired, pending, cancelled
|
||||
$table->date('start_date');
|
||||
$table->date('end_date')->nullable();
|
||||
$table->decimal('amount', 10, 2)->nullable();
|
||||
$table->string('currency', 3)->default('EUR');
|
||||
$table->text('notes')->nullable();
|
||||
$table->string('type')->default('other'); // microsoft_365, domain, software, fiber, other
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('contracts');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('contract_meta', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('contract_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('key');
|
||||
$table->text('value')->nullable();
|
||||
$table->unique(['contract_id', 'key']);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('contract_meta');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('audit_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->string('action');
|
||||
$table->text('description')->nullable();
|
||||
$table->ipAddress('ip_address')->nullable();
|
||||
$table->string('user_agent')->nullable();
|
||||
$table->json('changes')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('audit_logs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('documents', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('contract_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('filename');
|
||||
$table->string('path');
|
||||
$table->string('mime_type')->nullable();
|
||||
$table->integer('size')->nullable();
|
||||
$table->text('description')->nullable();
|
||||
$table->foreignId('uploaded_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('documents');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('municipalities', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('zip_code')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('municipalities');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('contracts', function (Blueprint $table) {
|
||||
$table->foreignId('municipality_id')->nullable()->constrained()->nullOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('contracts', function (Blueprint $table) {
|
||||
$table->dropConstrainedForeignId('municipality_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('license_levels', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->unique();
|
||||
$table->string('type')->default('microsoft_365');
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('license_levels');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('municipalities', function (Blueprint $table) {
|
||||
$table->boolean('is_active')->default(true);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('municipalities', function (Blueprint $table) {
|
||||
$table->dropColumn('is_active');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('global_settings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('key')->unique();
|
||||
$table->text('value')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('global_settings');
|
||||
}
|
||||
};
|
||||
33
database/migrations/2026_02_08_083221_create_links_table.php
Normal file
33
database/migrations/2026_02_08_083221_create_links_table.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('links', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('title');
|
||||
$table->string('url');
|
||||
$table->string('icon')->nullable()->default('bi-link');
|
||||
$table->string('color')->nullable()->default('primary'); // For styling badge/icon
|
||||
$table->integer('order')->default(0);
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('links');
|
||||
}
|
||||
};
|
||||
38
database/seeders/DatabaseSeeder.php
Normal file
38
database/seeders/DatabaseSeeder.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
use WithoutModelEvents;
|
||||
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$this->call(MunicipalitySeeder::class);
|
||||
|
||||
// User::factory(10)->create();
|
||||
|
||||
User::factory()->create([
|
||||
'name' => 'Admin User',
|
||||
'email' => 'admin@dsigest.local',
|
||||
'password' => \Illuminate\Support\Facades\Hash::make('password'),
|
||||
'role' => 'admin',
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
User::factory()->create([
|
||||
'name' => 'Manager User',
|
||||
'email' => 'manager@dsigest.local',
|
||||
'password' => \Illuminate\Support\Facades\Hash::make('password'),
|
||||
'role' => 'manager',
|
||||
'is_active' => true,
|
||||
]);
|
||||
}
|
||||
}
|
||||
28
database/seeders/LicenseLevelSeeder.php
Normal file
28
database/seeders/LicenseLevelSeeder.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\LicenseLevel;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class LicenseLevelSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$levels = [
|
||||
'Basic',
|
||||
'Standard',
|
||||
'Premium',
|
||||
'E3',
|
||||
'E5',
|
||||
'F3',
|
||||
];
|
||||
|
||||
foreach ($levels as $level) {
|
||||
LicenseLevel::firstOrCreate(['name' => $level], ['type' => 'microsoft_365']);
|
||||
}
|
||||
}
|
||||
}
|
||||
39
database/seeders/LinkSeeder.php
Normal file
39
database/seeders/LinkSeeder.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Link;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class LinkSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
Link::create([
|
||||
'title' => 'Google',
|
||||
'url' => 'https://google.com',
|
||||
'icon' => 'bi-google',
|
||||
'color' => 'danger',
|
||||
'order' => 10,
|
||||
]);
|
||||
|
||||
Link::create([
|
||||
'title' => 'Office 365',
|
||||
'url' => 'https://portal.office.com',
|
||||
'icon' => 'bi-microsoft',
|
||||
'color' => 'primary',
|
||||
'order' => 20,
|
||||
]);
|
||||
|
||||
Link::create([
|
||||
'title' => 'Support',
|
||||
'url' => '#',
|
||||
'icon' => 'bi-life-preserver',
|
||||
'color' => 'info',
|
||||
'order' => 30,
|
||||
]);
|
||||
}
|
||||
}
|
||||
39
database/seeders/MunicipalitySeeder.php
Normal file
39
database/seeders/MunicipalitySeeder.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Municipality;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class MunicipalitySeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$municipalities = [
|
||||
['name' => 'Béziers', 'zip_code' => '34500'],
|
||||
['name' => 'Alignan-du-Vent', 'zip_code' => '34290'],
|
||||
['name' => 'Bassan', 'zip_code' => '34290'],
|
||||
['name' => 'Boujan-sur-Libron', 'zip_code' => '34760'],
|
||||
['name' => 'Cers', 'zip_code' => '34420'],
|
||||
['name' => 'Corneilhan', 'zip_code' => '34490'],
|
||||
['name' => 'Coulobres', 'zip_code' => '34290'],
|
||||
['name' => 'Espondeilhan', 'zip_code' => '34290'],
|
||||
['name' => 'Lieuran-lès-Béziers', 'zip_code' => '34290'],
|
||||
['name' => 'Lignan-sur-Orb', 'zip_code' => '34490'],
|
||||
['name' => 'Montblanc', 'zip_code' => '34290'],
|
||||
['name' => 'Sauvian', 'zip_code' => '34410'],
|
||||
['name' => 'Sérignan', 'zip_code' => '34410'],
|
||||
['name' => 'Servian', 'zip_code' => '34290'],
|
||||
['name' => 'Valras-Plage', 'zip_code' => '34350'],
|
||||
['name' => 'Valros', 'zip_code' => '34290'],
|
||||
['name' => 'Villeneuve-lès-Béziers', 'zip_code' => '34420'],
|
||||
];
|
||||
|
||||
foreach ($municipalities as $municipality) {
|
||||
Municipality::firstOrCreate(['name' => $municipality['name']], $municipality);
|
||||
}
|
||||
}
|
||||
}
|
||||
2991
package-lock.json
generated
Normal file
2991
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
25
package.json
Normal file
25
package.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"$schema": "https://www.schemastore.org/package.json",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "vite build",
|
||||
"dev": "vite"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/vite": "^4.0.0",
|
||||
"axios": "^1.11.0",
|
||||
"concurrently": "^9.0.1",
|
||||
"laravel-vite-plugin": "^2.0.0",
|
||||
"tailwindcss": "^4.0.0",
|
||||
"vite": "^7.0.7"
|
||||
},
|
||||
"dependencies": {
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"@vitejs/plugin-vue": "^6.0.4",
|
||||
"bootstrap": "^5.3.8",
|
||||
"bootstrap-icons": "^1.13.1",
|
||||
"sass": "^1.97.3",
|
||||
"vue": "^3.5.27"
|
||||
}
|
||||
}
|
||||
35
phpunit.xml
Normal file
35
phpunit.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Unit">
|
||||
<directory>tests/Unit</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Feature">
|
||||
<directory>tests/Feature</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<source>
|
||||
<include>
|
||||
<directory>app</directory>
|
||||
</include>
|
||||
</source>
|
||||
<php>
|
||||
<env name="APP_ENV" value="testing"/>
|
||||
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
|
||||
<env name="BCRYPT_ROUNDS" value="4"/>
|
||||
<env name="BROADCAST_CONNECTION" value="null"/>
|
||||
<env name="CACHE_STORE" value="array"/>
|
||||
<env name="DB_CONNECTION" value="sqlite"/>
|
||||
<env name="DB_DATABASE" value=":memory:"/>
|
||||
<env name="MAIL_MAILER" value="array"/>
|
||||
<env name="QUEUE_CONNECTION" value="sync"/>
|
||||
<env name="SESSION_DRIVER" value="array"/>
|
||||
<env name="PULSE_ENABLED" value="false"/>
|
||||
<env name="TELESCOPE_ENABLED" value="false"/>
|
||||
<env name="NIGHTWATCH_ENABLED" value="false"/>
|
||||
</php>
|
||||
</phpunit>
|
||||
25
public/.htaccess
Normal file
25
public/.htaccess
Normal file
@@ -0,0 +1,25 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
<IfModule mod_negotiation.c>
|
||||
Options -MultiViews -Indexes
|
||||
</IfModule>
|
||||
|
||||
RewriteEngine On
|
||||
|
||||
# Handle Authorization Header
|
||||
RewriteCond %{HTTP:Authorization} .
|
||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||
|
||||
# Handle X-XSRF-Token Header
|
||||
RewriteCond %{HTTP:x-xsrf-token} .
|
||||
RewriteRule .* - [E=HTTP_X_XSRF_TOKEN:%{HTTP:X-XSRF-Token}]
|
||||
|
||||
# Redirect Trailing Slashes If Not A Folder...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_URI} (.+)/$
|
||||
RewriteRule ^ %1 [L,R=301]
|
||||
|
||||
# Send Requests To Front Controller...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [L]
|
||||
</IfModule>
|
||||
0
public/favicon.ico
Normal file
0
public/favicon.ico
Normal file
20
public/index.php
Normal file
20
public/index.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
// Determine if the application is in maintenance mode...
|
||||
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
|
||||
require $maintenance;
|
||||
}
|
||||
|
||||
// Register the Composer autoloader...
|
||||
require __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
// Bootstrap Laravel and handle the request...
|
||||
/** @var Application $app */
|
||||
$app = require_once __DIR__.'/../bootstrap/app.php';
|
||||
|
||||
$app->handleRequest(Request::capture());
|
||||
2
public/robots.txt
Normal file
2
public/robots.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
User-agent: *
|
||||
Disallow:
|
||||
424
resources/css/app.scss
Normal file
424
resources/css/app.scss
Normal file
@@ -0,0 +1,424 @@
|
||||
// 1. Define variables first
|
||||
$body-bg: #1e2531;
|
||||
$body-color: #aeb4c6;
|
||||
$headings-color: #fff;
|
||||
$card-bg: #2c3344;
|
||||
$card-color: #aeb4c6;
|
||||
$card-border-width: 0;
|
||||
$border-color: #3e485e;
|
||||
$primary: #727cf5;
|
||||
$success: #0acf97;
|
||||
$danger: #fa5c7c;
|
||||
$warning: #ffbc00;
|
||||
$info: #39afd1;
|
||||
|
||||
// 2. Import Bootstrap
|
||||
@import 'bootstrap/scss/bootstrap';
|
||||
@import 'bootstrap-icons/font/bootstrap-icons.css';
|
||||
|
||||
// 3. Custom Global Styles
|
||||
body {
|
||||
background-color: $body-bg;
|
||||
color: $body-color;
|
||||
font-family: 'Inter', system-ui, -apple-system, sans-serif;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
.h1,
|
||||
.h2,
|
||||
.h3,
|
||||
.h4,
|
||||
.h5,
|
||||
.h6 {
|
||||
color: $headings-color;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
a {
|
||||
color: $primary;
|
||||
text-decoration: none;
|
||||
|
||||
&:hover {
|
||||
color: darken($primary, 10%);
|
||||
}
|
||||
}
|
||||
|
||||
.text-muted {
|
||||
color: #8391a2 !important;
|
||||
}
|
||||
|
||||
.text-white {
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.bg-light {
|
||||
background-color: #313a4e !important;
|
||||
}
|
||||
|
||||
.bg-white {
|
||||
background-color: $card-bg !important;
|
||||
}
|
||||
|
||||
.border {
|
||||
border-color: $border-color !important;
|
||||
}
|
||||
|
||||
// 4. Component Overrides
|
||||
.card {
|
||||
background-color: $card-bg;
|
||||
box-shadow: 0 0.2rem 1rem rgba(0, 0, 0, 0.15);
|
||||
border: none;
|
||||
margin-bottom: 1.5rem;
|
||||
|
||||
.card-header {
|
||||
background-color: transparent;
|
||||
border-bottom: 1px solid $border-color;
|
||||
padding: 1.5rem;
|
||||
|
||||
h5 {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.card-body {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.list-group-item {
|
||||
background-color: transparent;
|
||||
border-color: $border-color;
|
||||
color: $body-color;
|
||||
}
|
||||
|
||||
.table {
|
||||
color: #fff; // Force white text for table content
|
||||
|
||||
th {
|
||||
border-color: $border-color;
|
||||
color: $headings-color;
|
||||
font-weight: 600;
|
||||
background-color: transparent; // Ensure header is transparent
|
||||
border-bottom-width: 1px;
|
||||
}
|
||||
|
||||
td {
|
||||
border-color: $border-color;
|
||||
vertical-align: middle;
|
||||
color: #fff; // Ensure cells are white
|
||||
}
|
||||
|
||||
// Striped rows
|
||||
&.table-striped>tbody>tr:nth-of-type(odd)>* {
|
||||
background-color: rgba(255, 255, 255, 0.02);
|
||||
color: #fff; // Ensure striped rows are white
|
||||
box-shadow: none; // Remove potential inset shadows
|
||||
}
|
||||
|
||||
// Hover effect
|
||||
&:hover tbody tr:hover {
|
||||
background-color: rgba(255, 255, 255, 0.05);
|
||||
color: $headings-color;
|
||||
}
|
||||
|
||||
// Table Warning Override for Dark Theme
|
||||
&.table-hover>tbody>tr.table-warning:hover>* {
|
||||
background-color: rgba($warning, 0.2);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
>tbody>tr.table-warning>* {
|
||||
background-color: rgba($warning, 0.15); // Slightly more visible yellow bg
|
||||
color: #ffedb8; // Light yellowish white text for readability
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
// NEW: Table Danger (Orange/Red) Override for Deactivated functionality
|
||||
// User asked for "Orange background with white text" for deactivated items
|
||||
// We are using `table-warning` which is yellow/orange.
|
||||
// Let's customize `table-warning` to look more orange-ish if that's what the user wants,
|
||||
// OR create a specific override if they mean `table-secondary` was the issue.
|
||||
// The user moved from `table-secondary` (grey) to `table-warning` (yellow/orange) in the blade file.
|
||||
// So now we need to make sure `table-warning` looks good (Orange background, white text).
|
||||
|
||||
// Let's override table-warning specifically to be orange-ish
|
||||
$orange-custom: #fd7e14;
|
||||
|
||||
>tbody>tr.table-warning>* {
|
||||
background-color: rgba($orange-custom, 0.2) !important; // Orange-ish background
|
||||
color: #fff !important; // White text
|
||||
}
|
||||
|
||||
&.table-hover>tbody>tr.table-warning:hover>* {
|
||||
background-color: rgba($orange-custom, 0.3) !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
}
|
||||
|
||||
.form-control,
|
||||
.form-select {
|
||||
background-color: #313a4e;
|
||||
border-color: $border-color;
|
||||
color: $headings-color;
|
||||
|
||||
&:focus {
|
||||
background-color: #364056;
|
||||
border-color: $primary;
|
||||
color: $headings-color;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
&::placeholder {
|
||||
color: #6c757d;
|
||||
}
|
||||
}
|
||||
|
||||
// Badges - Force white text for better contrast in dark mode
|
||||
.badge {
|
||||
color: #fff !important; // Force white text on all badges
|
||||
font-weight: 500;
|
||||
|
||||
&.bg-light {
|
||||
background-color: #3e485e !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
&.bg-info {
|
||||
background-color: $info !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
&.bg-warning {
|
||||
background-color: $warning !important;
|
||||
color: #000 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.text-bg-warning {
|
||||
color: #000 !important;
|
||||
background-color: $warning !important;
|
||||
}
|
||||
|
||||
// FORCE badge overrides
|
||||
.badge.bg-info {
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.badge.bg-success {
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
$warning-dark: #d9a406;
|
||||
|
||||
.badge.bg-warning {
|
||||
background-color: $warning-dark !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
|
||||
// 5. Layout Structure (Sidebar + Main)
|
||||
#app {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
width: 260px;
|
||||
background-color: #313a44;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-right: 1px solid rgba(255, 255, 255, 0.05);
|
||||
height: 100vh;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1000;
|
||||
|
||||
.sidebar-brand {
|
||||
height: 70px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 1.5rem;
|
||||
font-size: 1.25rem;
|
||||
font-weight: 700;
|
||||
color: $primary;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
|
||||
|
||||
a {
|
||||
color: $primary;
|
||||
}
|
||||
}
|
||||
|
||||
.nav-link {
|
||||
color: #aeb4c6;
|
||||
padding: 0.8rem 1.5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
transition: all 0.2s;
|
||||
border-left: 3px solid transparent;
|
||||
|
||||
i {
|
||||
margin-right: 0.75rem;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
&:hover,
|
||||
&.active {
|
||||
color: #fff;
|
||||
background-color: rgba(255, 255, 255, 0.03);
|
||||
border-left-color: $primary;
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar-heading {
|
||||
font-size: 0.75rem;
|
||||
text-transform: uppercase;
|
||||
color: #6c757d;
|
||||
padding: 1.5rem 1.5rem 0.5rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
}
|
||||
|
||||
.main-content {
|
||||
flex-grow: 1;
|
||||
margin-left: 260px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100vh;
|
||||
background-color: $body-bg;
|
||||
}
|
||||
|
||||
.topbar {
|
||||
height: 70px;
|
||||
background-color: $card-bg;
|
||||
border-bottom: 1px solid $border-color;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 2rem;
|
||||
margin-bottom: 2rem;
|
||||
box-shadow: 0 0 35px 0 rgba(154, 161, 171, .15);
|
||||
}
|
||||
|
||||
// 6. Timeline Component (Dark Theme Adapted)
|
||||
.timeline-wrapper {
|
||||
overflow-x: auto;
|
||||
padding: 20px 0;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
height: 6px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background-color: $border-color;
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.timeline {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
position: relative;
|
||||
min-width: 800px;
|
||||
padding: 0 40px;
|
||||
margin-bottom: 20px;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 2px;
|
||||
background-color: $border-color;
|
||||
z-index: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.timeline-item {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
text-align: center;
|
||||
flex: 1;
|
||||
|
||||
.timeline-dot {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
background-color: $card-bg;
|
||||
border: 3px solid $primary;
|
||||
border-radius: 50%;
|
||||
margin: 13px auto 15px;
|
||||
transition: all 0.2s ease;
|
||||
box-shadow: 0 0 0 3px $body-bg;
|
||||
}
|
||||
|
||||
.timeline-date {
|
||||
position: absolute;
|
||||
top: -25px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
font-size: 0.8rem;
|
||||
font-weight: 600;
|
||||
color: $body-color;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.timeline-content {
|
||||
background: $card-bg;
|
||||
border: 1px solid $border-color;
|
||||
border-radius: 6px;
|
||||
padding: 8px 12px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
||||
display: inline-block;
|
||||
max-width: 180px;
|
||||
min-width: 120px;
|
||||
transition: transform 0.2s;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
|
||||
&:hover {
|
||||
transform: translateY(-3px);
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
|
||||
border-color: $primary;
|
||||
text-decoration: none;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
h6 {
|
||||
color: #fff;
|
||||
font-size: 0.9rem;
|
||||
margin: 0;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
small {
|
||||
font-size: 0.75rem;
|
||||
color: #8391a2;
|
||||
}
|
||||
}
|
||||
|
||||
&.expired .timeline-dot {
|
||||
border-color: #6c757d;
|
||||
}
|
||||
|
||||
&.urgent .timeline-dot {
|
||||
border-color: $danger;
|
||||
}
|
||||
|
||||
&.soon .timeline-dot {
|
||||
border-color: $warning;
|
||||
}
|
||||
|
||||
&.normal .timeline-dot {
|
||||
border-color: $success;
|
||||
}
|
||||
}
|
||||
17
resources/js/app.js
Normal file
17
resources/js/app.js
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
import './bootstrap';
|
||||
import '../css/app.scss';
|
||||
|
||||
import { createApp } from 'vue';
|
||||
import * as bootstrap from 'bootstrap'; // Make bootstrap available globally if needed, or just import
|
||||
window.bootstrap = bootstrap;
|
||||
|
||||
import ContractsTable from './components/ContractsTable.vue';
|
||||
|
||||
const app = createApp({
|
||||
components: {
|
||||
ContractsTable,
|
||||
}
|
||||
});
|
||||
|
||||
app.mount('#app');
|
||||
4
resources/js/bootstrap.js
vendored
Normal file
4
resources/js/bootstrap.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import axios from 'axios';
|
||||
window.axios = axios;
|
||||
|
||||
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
||||
120
resources/js/components/ContractsTable.vue
Normal file
120
resources/js/components/ContractsTable.vue
Normal file
@@ -0,0 +1,120 @@
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
initialContracts: {
|
||||
type: Object, // Laravel Paginate Object
|
||||
required: true
|
||||
}
|
||||
});
|
||||
|
||||
const contracts = ref(props.initialContracts.data);
|
||||
const searchQuery = ref('');
|
||||
const typeFilter = ref('');
|
||||
|
||||
const filteredContracts = computed(() => {
|
||||
return contracts.value.filter(contract => {
|
||||
const matchesSearch = contract.name.toLowerCase().includes(searchQuery.value.toLowerCase()) ||
|
||||
contract.provider.toLowerCase().includes(searchQuery.value.toLowerCase()) ||
|
||||
(contract.municipality && contract.municipality.name.toLowerCase().includes(searchQuery.value.toLowerCase()));
|
||||
const matchesType = typeFilter.value ? contract.type === typeFilter.value : true;
|
||||
return matchesSearch && matchesType;
|
||||
});
|
||||
});
|
||||
|
||||
const formatDate = (date) => {
|
||||
return new Date(date).toLocaleDateString('fr-FR');
|
||||
};
|
||||
|
||||
const formatCurrency = (amount, currency) => {
|
||||
return new Intl.NumberFormat('fr-FR', { style: 'currency', currency: currency }).format(amount);
|
||||
};
|
||||
|
||||
const isExpiringSoon = (dateString) => {
|
||||
if (!dateString) return false;
|
||||
const today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
const date = new Date(dateString);
|
||||
|
||||
// Create date 2 months from now
|
||||
const twoMonthsFromNow = new Date();
|
||||
twoMonthsFromNow.setMonth(today.getMonth() + 2);
|
||||
|
||||
// Check if date is in the future (or today) AND before 2 months from now
|
||||
// If it's already past, it's expired, not expiring soon (unless we want to highlight overdue too but usually that's red)
|
||||
// The user asked "arrivant a échéances", implies approaching.
|
||||
// Let's include today.
|
||||
return date >= today && date <= twoMonthsFromNow;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="card shadow-sm border-0">
|
||||
<div class="card-header border-bottom-0 d-flex justify-content-between align-items-center">
|
||||
<h5 class="mb-0 text-white">Contrats</h5>
|
||||
<div class="d-flex gap-2">
|
||||
<input v-model="searchQuery" type="text" class="form-control form-control-sm" placeholder="Rechercher...">
|
||||
<select v-model="typeFilter" class="form-select form-select-sm">
|
||||
<option value="">Tous les types</option>
|
||||
<option value="microsoft_365">Microsoft 365</option>
|
||||
<option value="fiber">Fibre</option>
|
||||
<option value="domain">Domaine</option>
|
||||
<option value="software">Logiciel</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover align-middle mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nom</th>
|
||||
<th>Commune</th>
|
||||
<th>Fournisseur</th>
|
||||
<th>Type</th>
|
||||
<th>État</th>
|
||||
<th>Date fin</th>
|
||||
<th>Montant</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="contract in filteredContracts" :key="contract.id" :class="{ 'table-warning': isExpiringSoon(contract.end_date) && contract.status !== 'expired' }">
|
||||
<td>
|
||||
{{ contract.name }}
|
||||
<i v-if="isExpiringSoon(contract.end_date) && contract.status !== 'expired'" class="bi bi-exclamation-triangle-fill text-warning ms-1" title="Expire dans moins de 2 mois"></i>
|
||||
</td>
|
||||
<td>
|
||||
<span v-if="contract.municipality" class="badge bg-secondary">{{ contract.municipality.name }}</span>
|
||||
<span v-else class="text-muted small">Global</span>
|
||||
</td>
|
||||
<td>{{ contract.provider }}</td>
|
||||
<td>
|
||||
<span class="badge bg-info">{{ contract.type }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<span :class="{
|
||||
'badge bg-success': contract.status === 'active',
|
||||
'badge bg-warning': contract.status === 'pending',
|
||||
'badge bg-danger': contract.status === 'expired',
|
||||
'badge bg-secondary': contract.status === 'draft' || contract.status === 'cancelled'
|
||||
}">{{ contract.status }}</span>
|
||||
</td>
|
||||
<td :class="{ 'fw-bold text-danger': isExpiringSoon(contract.end_date) && contract.status !== 'expired' }">
|
||||
{{ contract.end_date ? formatDate(contract.end_date) : '-' }}
|
||||
</td>
|
||||
<td>{{ contract.amount ? formatCurrency(contract.amount, contract.currency) : '-' }}</td>
|
||||
<td>
|
||||
<a :href="`/contracts/${contract.id}`" class="btn btn-sm btn-outline-primary me-1">
|
||||
Voir
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="filteredContracts.length === 0">
|
||||
<td colspan="8" class="text-center py-3 text-muted">Aucun contrat trouvé.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- Simple Pagination links (could be enhanced) -->
|
||||
</div>
|
||||
</template>
|
||||
69
resources/views/admin/license_levels/index.blade.php
Normal file
69
resources/views/admin/license_levels/index.blade.php
Normal file
@@ -0,0 +1,69 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<h2 class="mb-4">Gestion des Niveaux de Licence M365</h2>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="card shadow-sm mb-4">
|
||||
<div class="card-header bg-primary text-white">Ajouter un niveau</div>
|
||||
<div class="card-body">
|
||||
<form action="{{ route('admin.license_levels.store') }}" method="POST">
|
||||
@csrf
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Nom du niveau</label>
|
||||
<input type="text" name="name" class="form-control" placeholder="ex: E1, Business Basic" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success w-100">Ajouter</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body">
|
||||
<table class="table table-hover align-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nom</th>
|
||||
<th>Statut</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($levels as $level)
|
||||
<tr class="{{ $level->is_active ? '' : 'table-warning' }}">
|
||||
<td>{{ $level->name }}</td>
|
||||
<td>
|
||||
@if($level->is_active)
|
||||
<span class="badge bg-success">Actif</span>
|
||||
@else
|
||||
<span class="badge bg-secondary">Désactivé</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
<div class="d-flex gap-2">
|
||||
<form action="{{ route('admin.license_levels.toggle', $level) }}" method="POST">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm {{ $level->is_active ? 'btn-outline-danger' : 'btn-outline-success' }}">
|
||||
{{ $level->is_active ? 'Désactiver' : 'Activer' }}
|
||||
</button>
|
||||
</form>
|
||||
<form action="{{ route('admin.license_levels.destroy', $level) }}" method="POST" onsubmit="return confirm('Supprimer ce niveau ?');">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button class="btn btn-sm btn-danger"><i class="bi bi-trash"></i></button>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
52
resources/views/admin/links/edit.blade.php
Normal file
52
resources/views/admin/links/edit.blade.php
Normal file
@@ -0,0 +1,52 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h2>Modifier le lien</h2>
|
||||
<a href="{{ route('admin.links.index') }}" class="btn btn-secondary">Retour</a>
|
||||
</div>
|
||||
|
||||
<div class="card shadow-sm col-md-8 mx-auto">
|
||||
<div class="card-body">
|
||||
<form action="{{ route('admin.links.update', $link) }}" method="POST">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Titre</label>
|
||||
<input type="text" name="title" class="form-control" value="{{ $link->title }}" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">URL</label>
|
||||
<input type="url" name="url" class="form-control" value="{{ $link->url }}" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Icône Bootstrap</label>
|
||||
<input type="text" name="icon" class="form-control" value="{{ $link->icon }}">
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Couleur</label>
|
||||
<select name="color" class="form-select">
|
||||
@foreach(['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark'] as $color)
|
||||
<option value="{{ $color }}" {{ $link->color == $color ? 'selected' : '' }}>
|
||||
{{ ucfirst($color) }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Ordre</label>
|
||||
<input type="number" name="order" class="form-control" value="{{ $link->order }}">
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary w-100">Mettre à jour</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
103
resources/views/admin/links/index.blade.php
Normal file
103
resources/views/admin/links/index.blade.php
Normal file
@@ -0,0 +1,103 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<h2 class="mb-4">Gestion des Liens Utiles</h2>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="card shadow-sm mb-4">
|
||||
<div class="card-header bg-primary text-white">Ajouter un lien</div>
|
||||
<div class="card-body">
|
||||
<form action="{{ route('admin.links.store') }}" method="POST">
|
||||
@csrf
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Titre</label>
|
||||
<input type="text" name="title" class="form-control" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">URL</label>
|
||||
<input type="url" name="url" class="form-control" placeholder="https://..." required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Icône Bootstrap (ex: bi-google)</label>
|
||||
<input type="text" name="icon" class="form-control" placeholder="bi-link">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Couleur (Bootstrap Context)</label>
|
||||
<select name="color" class="form-select">
|
||||
<option value="primary">Primary (Blue)</option>
|
||||
<option value="secondary">Secondary (Grey)</option>
|
||||
<option value="success">Success (Green)</option>
|
||||
<option value="danger">Danger (Red)</option>
|
||||
<option value="warning">Warning (Yellow)</option>
|
||||
<option value="info">Info (Cyan)</option>
|
||||
<option value="dark">Dark</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Ordre</label>
|
||||
<input type="number" name="order" class="form-control" value="0">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success w-100">Ajouter</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body">
|
||||
<table class="table table-hover align-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Icône</th>
|
||||
<th>Titre / URL</th>
|
||||
<th>Ordre</th>
|
||||
<th>Statut</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($links as $link)
|
||||
<tr class="{{ $link->is_active ? '' : 'table-warning' }}">
|
||||
<td><i class="bi {{ $link->icon }} text-{{ $link->color }}"></i></td>
|
||||
<td>
|
||||
<strong>{{ $link->title }}</strong><br>
|
||||
<small class="text-muted">{{ $link->url }}</small>
|
||||
</td>
|
||||
<td>{{ $link->order }}</td>
|
||||
<td>
|
||||
@if($link->is_active)
|
||||
<span class="badge bg-success">Actif</span>
|
||||
@else
|
||||
<span class="badge bg-secondary">Désactivé</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
<div class="d-flex gap-2">
|
||||
<a href="{{ route('admin.links.edit', $link) }}" class="btn btn-sm btn-outline-primary">
|
||||
<i class="bi bi-pencil"></i>
|
||||
</a>
|
||||
<form action="{{ route('admin.links.toggle', $link) }}" method="POST">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm {{ $link->is_active ? 'btn-outline-danger' : 'btn-outline-success' }}">
|
||||
{{ $link->is_active ? 'Désactiver' : 'Activer' }}
|
||||
</button>
|
||||
</form>
|
||||
<form action="{{ route('admin.links.destroy', $link) }}" method="POST" onsubmit="return confirm('Supprimer ce lien ?');">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button class="btn btn-sm btn-danger"><i class="bi bi-trash"></i></button>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
47
resources/views/admin/municipalities/index.blade.php
Normal file
47
resources/views/admin/municipalities/index.blade.php
Normal file
@@ -0,0 +1,47 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<h2 class="mb-4">Gestion des Communes</h2>
|
||||
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover align-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nom</th>
|
||||
<th>Code Postal</th>
|
||||
<th>Statut</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($municipalities as $municipality)
|
||||
<tr class="{{ $municipality->is_active ? '' : 'table-warning' }}">
|
||||
<td>{{ $municipality->name }}</td>
|
||||
<td>{{ $municipality->zip_code }}</td>
|
||||
<td>
|
||||
@if($municipality->is_active)
|
||||
<span class="badge bg-success">Active</span>
|
||||
@else
|
||||
<span class="badge bg-secondary">Désactivée</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
<form action="{{ route('admin.municipalities.toggle', $municipality) }}" method="POST">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm {{ $municipality->is_active ? 'btn-outline-danger' : 'btn-outline-success' }}">
|
||||
{{ $municipality->is_active ? 'Désactiver' : 'Activer' }}
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
47
resources/views/auth/login.blade.php
Normal file
47
resources/views/auth/login.blade.php
Normal file
@@ -0,0 +1,47 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-6 col-lg-4">
|
||||
<div class="card shadow-lg border-0 rounded-lg mt-5">
|
||||
<div class="card-header border-0 text-center py-4 bg-primary text-white">
|
||||
<h3 class="font-weight-light my-2">Connexion</h3>
|
||||
</div>
|
||||
<div class="card-body p-4">
|
||||
<form method="POST" action="{{ route('login') }}">
|
||||
@csrf
|
||||
<div class="form-floating mb-3">
|
||||
<input class="form-control @error('email') is-invalid @enderror" id="inputEmail" type="email" name="email" placeholder="name@example.com" value="{{ old('email') }}" required autofocus />
|
||||
<label for="inputEmail">Adresse Email</label>
|
||||
@error('email')
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{{ $message }}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="form-floating mb-3">
|
||||
<input class="form-control @error('password') is-invalid @enderror" id="inputPassword" type="password" name="password" placeholder="Password" required />
|
||||
<label for="inputPassword">Mot de passe</label>
|
||||
@error('password')
|
||||
<span class="invalid-feedback" role="alert">
|
||||
<strong>{{ $message }}</strong>
|
||||
</span>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="form-check mb-3">
|
||||
<input class="form-check-input" id="inputRememberPassword" type="checkbox" name="remember" />
|
||||
<label class="form-check-label" for="inputRememberPassword">Se souvenir de moi</label>
|
||||
</div>
|
||||
<div class="d-flex align-items-center justify-content-between mt-4 mb-0">
|
||||
<a class="small text-decoration-none" href="#">Mot de passe oublié?</a>
|
||||
<button type="submit" class="btn btn-primary w-100 ms-3">Se connecter</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="card-footer text-center py-3 bg-light border-0">
|
||||
<div class="small"><a href="{{ route('register') }}" class="text-decoration-none">Pas de compte? S'inscrire!</a></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
47
resources/views/auth/register.blade.php
Normal file
47
resources/views/auth/register.blade.php
Normal file
@@ -0,0 +1,47 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-6 col-lg-5">
|
||||
<div class="card shadow-lg border-0 rounded-lg mt-5">
|
||||
<div class="card-header border-0 text-center py-4 bg-success text-white">
|
||||
<h3 class="font-weight-light my-2">Créer un compte</h3>
|
||||
<p class="mb-0 small">Nécessite une validation administrateur</p>
|
||||
</div>
|
||||
<div class="card-body p-4">
|
||||
<form method="POST" action="{{ route('register') }}">
|
||||
@csrf
|
||||
<div class="form-floating mb-3">
|
||||
<input class="form-control" id="inputName" type="text" name="name" placeholder="Nom complet" value="{{ old('name') }}" required autofocus />
|
||||
<label for="inputName">Nom Complet</label>
|
||||
</div>
|
||||
<div class="form-floating mb-3">
|
||||
<input class="form-control" id="inputEmail" type="email" name="email" placeholder="name@example.com" value="{{ old('email') }}" required />
|
||||
<label for="inputEmail">Adresse Email</label>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6">
|
||||
<div class="form-floating mb-3 mb-md-0">
|
||||
<input class="form-control" id="inputPassword" type="password" name="password" placeholder="Create a password" required />
|
||||
<label for="inputPassword">Mot de passe</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-floating mb-3 mb-md-0">
|
||||
<input class="form-control" id="inputPasswordConfirm" type="password" name="password_confirmation" placeholder="Confirm password" required />
|
||||
<label for="inputPasswordConfirm">Confirmation</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-4 mb-0">
|
||||
<div class="d-grid"><button class="btn btn-success btn-block" type="submit">S'inscrire</button></div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="card-footer text-center py-3 bg-light border-0">
|
||||
<div class="small"><a href="{{ route('login') }}" class="text-decoration-none">Déjà inscrit? Aller à la connexion</a></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
135
resources/views/contracts/create.blade.php
Normal file
135
resources/views/contracts/create.blade.php
Normal file
@@ -0,0 +1,135 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-header bg-primary text-white">Nouveau Contrat</div>
|
||||
|
||||
<div class="card-body">
|
||||
<form method="POST" action="{{ route('contracts.store') }}">
|
||||
@csrf
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="name" class="form-label">Nom du Contrat</label>
|
||||
<input type="text" class="form-control" id="name" name="name" required placeholder="ex: Maintenance Serveurs">
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6">
|
||||
<label for="provider" class="form-label">Fournisseur</label>
|
||||
<input type="text" class="form-control" id="provider" name="provider" required>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label for="municipality_id" class="form-label">Commune Affectée</label>
|
||||
<select class="form-select" id="municipality_id" name="municipality_id">
|
||||
<option value="">Global / Agglomération</option>
|
||||
@foreach($municipalities as $municipality)
|
||||
<option value="{{ $municipality->id }}">{{ $municipality->name }} ({{ $municipality->zip_code }})</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="reference" class="form-label">Référence</label>
|
||||
<input type="text" class="form-control" id="reference" name="reference">
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6">
|
||||
<label for="start_date" class="form-label">Date Début</label>
|
||||
<input type="date" class="form-control" id="start_date" name="start_date" required>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label for="end_date" class="form-label">Date Fin (Optionnel)</label>
|
||||
<input type="date" class="form-control" id="end_date" name="end_date">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6">
|
||||
<label for="amount" class="form-label">Montant (€)</label>
|
||||
<input type="number" step="0.01" class="form-control" id="amount" name="amount">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label for="type" class="form-label">Type</label>
|
||||
<select class="form-select" id="type" name="type" required>
|
||||
<option value="microsoft_365">Microsoft 365</option>
|
||||
<option value="fiber">Fibre / Internet</option>
|
||||
<option value="domain">Nom de Domaine</option>
|
||||
<option value="software">Logiciel / Licence</option>
|
||||
<option value="hardware">Matériel</option>
|
||||
<option value="consulting">Prestation Intellectuelle</option>
|
||||
<option value="other">Autre</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="m365-fields" class="mb-3 p-3 bg-light border rounded" style="display: none;">
|
||||
<h6>Détails Microsoft 365</h6>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Niveau de Licence</label>
|
||||
<select class="form-select" name="meta[m365_license_level]">
|
||||
<option value="">Sélectionner...</option>
|
||||
@foreach($licenseLevels as $level)
|
||||
<option value="{{ $level->name }}">{{ $level->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Nombre de Licences</label>
|
||||
<input type="number" class="form-control" name="meta[m365_quantity]" placeholder="ex: 10">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="notes" class="form-label">Notes</label>
|
||||
<textarea class="form-control" id="notes" name="notes" rows="3"></textarea>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<h5>Méta-données supplémentaires</h5>
|
||||
<div id="meta-fields">
|
||||
<div class="row mb-2">
|
||||
<div class="col-md-5">
|
||||
<input type="text" class="form-control" name="meta[key1]" placeholder="Clé (ex: Débit)">
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<input type="text" class="form-control" name="meta[value1]" placeholder="Valeur (ex: 1Gbps)">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-grid gap-2 mt-4">
|
||||
<button type="submit" class="btn btn-primary">Créer le Contrat</button>
|
||||
<a href="{{ route('contracts.index') }}" class="btn btn-link text-muted">Annuler</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const typeSelect = document.getElementById('type');
|
||||
const m365Fields = document.getElementById('m365-fields');
|
||||
|
||||
function toggleFields() {
|
||||
if (typeSelect.value === 'microsoft_365') {
|
||||
m365Fields.style.display = 'block';
|
||||
} else {
|
||||
m365Fields.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
typeSelect.addEventListener('change', toggleFields);
|
||||
toggleFields(); // Initial check
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
127
resources/views/contracts/edit.blade.php
Normal file
127
resources/views/contracts/edit.blade.php
Normal file
@@ -0,0 +1,127 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-header bg-primary text-white">Modifier le Contrat</div>
|
||||
|
||||
<div class="card-body">
|
||||
<form method="POST" action="{{ route('contracts.update', $contract) }}">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="name" class="form-label">Nom du Contrat</label>
|
||||
<input type="text" class="form-control" id="name" name="name" value="{{ old('name', $contract->name) }}" required>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6">
|
||||
<label for="provider" class="form-label">Fournisseur</label>
|
||||
<input type="text" class="form-control" id="provider" name="provider" value="{{ old('provider', $contract->provider) }}" required>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label for="municipality_id" class="form-label">Commune Affectée</label>
|
||||
<select class="form-select" id="municipality_id" name="municipality_id">
|
||||
<option value="">Global / Agglomération</option>
|
||||
@foreach($municipalities as $municipality)
|
||||
<option value="{{ $municipality->id }}" {{ (old('municipality_id', $contract->municipality_id) == $municipality->id) ? 'selected' : '' }}>
|
||||
{{ $municipality->name }} ({{ $municipality->zip_code }})
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="reference" class="form-label">Référence</label>
|
||||
<input type="text" class="form-control" id="reference" name="reference" value="{{ old('reference', $contract->reference) }}">
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6">
|
||||
<label for="start_date" class="form-label">Date Début</label>
|
||||
<input type="date" class="form-control" id="start_date" name="start_date" value="{{ old('start_date', $contract->start_date->format('Y-m-d')) }}" required>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label for="end_date" class="form-label">Date Fin (Optionnel)</label>
|
||||
<input type="date" class="form-control" id="end_date" name="end_date" value="{{ old('end_date', $contract->end_date ? $contract->end_date->format('Y-m-d') : '') }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6">
|
||||
<label for="amount" class="form-label">Montant (€)</label>
|
||||
<input type="number" step="0.01" class="form-control" id="amount" name="amount" value="{{ old('amount', $contract->amount) }}">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label for="status" class="form-label">Statut</label>
|
||||
<select class="form-select" id="status" name="status" required>
|
||||
<option value="active" {{ $contract->status == 'active' ? 'selected' : '' }}>Actif</option>
|
||||
<option value="pending" {{ $contract->status == 'pending' ? 'selected' : '' }}>En attente</option>
|
||||
<option value="expired" {{ $contract->status == 'expired' ? 'selected' : '' }}>Expiré</option>
|
||||
<option value="cancelled" {{ $contract->status == 'cancelled' ? 'selected' : '' }}>Annulé</option>
|
||||
<option value="draft" {{ $contract->status == 'draft' ? 'selected' : '' }}>Brouillon</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="notes" class="form-label">Notes</label>
|
||||
<textarea class="form-control" id="notes" name="notes" rows="3">{{ old('notes', $contract->notes) }}</textarea>
|
||||
</div>
|
||||
|
||||
<!-- M365 Specifics -->
|
||||
@if($contract->type === 'microsoft_365')
|
||||
<div id="m365-fields" class="mb-3 p-3 bg-light border rounded">
|
||||
<h6>Détails Microsoft 365</h6>
|
||||
@php
|
||||
$level = $contract->meta->where('key', 'm365_license_level')->first()?->value;
|
||||
$qty = $contract->meta->where('key', 'm365_quantity')->first()?->value;
|
||||
@endphp
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Niveau de Licence</label>
|
||||
<select class="form-select" name="meta[m365_license_level]">
|
||||
<option value="">Sélectionner...</option>
|
||||
@php
|
||||
// Fallback if licenseLevels is not passed (though controller should pass it)
|
||||
$licenseLevels = $licenseLevels ?? \App\Models\LicenseLevel::active()->get();
|
||||
@endphp
|
||||
@foreach($licenseLevels as $l)
|
||||
<option value="{{ $l->name }}" {{ $level == $l->name ? 'selected' : '' }}>{{ $l->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Nombre de Licences</label>
|
||||
<input type="number" class="form-control" name="meta[m365_quantity]" value="{{ $qty }}" placeholder="ex: 10">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- Meta Data Handling could be improved here, currently simplistic -->
|
||||
|
||||
<div class="d-grid gap-2 mt-4">
|
||||
<button type="submit" class="btn btn-primary">Mettre à jour</button>
|
||||
<a href="{{ route('contracts.show', $contract) }}" class="btn btn-link text-muted">Annuler</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<hr>
|
||||
@if(auth()->user()->isAdmin())
|
||||
<form action="{{ route('contracts.destroy', $contract) }}" method="POST" onsubmit="return confirm('Êtes-vous sûr de vouloir supprimer définitivement ce contrat ?');">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="btn btn-outline-danger w-100">Supprimer le Contrat</button>
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
28
resources/views/contracts/index.blade.php
Normal file
28
resources/views/contracts/index.blade.php
Normal file
@@ -0,0 +1,28 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', 'Gestion des Contrats')
|
||||
|
||||
@section('content')
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-8">
|
||||
<p class="text-muted">Gérer les contrats de l'agglomération ({{ $contracts->total() }})</p>
|
||||
</div>
|
||||
<div class="col-md-4 text-end">
|
||||
@if(auth()->user()->isManager())
|
||||
<a href="{{ route('contracts.create') }}" class="btn btn-primary shadow-sm">
|
||||
<i class="bi bi-plus-lg"></i> Nouveau Contrat
|
||||
</a>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="contracts-list-section">
|
||||
<!-- Vue Component -->
|
||||
<contracts-table :initial-contracts="{{ json_encode($contracts) }}"></contracts-table>
|
||||
|
||||
<div class="pagination mt-3 justify-content-center">
|
||||
{{ $contracts->links() }}
|
||||
<!-- Note: If using Vue-driven pagination, links() might conflict unless handled properly, but here we just pass initial page -->
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
136
resources/views/contracts/show.blade.php
Normal file
136
resources/views/contracts/show.blade.php
Normal file
@@ -0,0 +1,136 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="mb-4">
|
||||
<a href="{{ route('contracts.index') }}" class="btn btn-outline-secondary">← Retour</a>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="card shadow-sm mb-4">
|
||||
<div class="card-header bg-white d-flex justify-content-between align-items-center">
|
||||
<h3 class="mb-0">{{ $contract->name }}</h3>
|
||||
@if(auth()->user()->isManager())
|
||||
<a href="{{ route('contracts.edit', $contract) }}" class="btn btn-sm btn-outline-primary">Modifier</a>
|
||||
@endif
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6">
|
||||
<strong>Fournisseur:</strong> {{ $contract->provider }}
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<strong>Référence:</strong> {{ $contract->reference ?? 'N/A' }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-12">
|
||||
<strong>Commune:</strong>
|
||||
@if($contract->municipality)
|
||||
<span class="badge bg-secondary">{{ $contract->municipality->name }} ({{ $contract->municipality->zip_code }})</span>
|
||||
@else
|
||||
<span class="badge bg-light text-dark border">Global / Agglomération</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6">
|
||||
<strong>Type:</strong> <span class="badge bg-info text-dark">{{ $contract->type }}</span>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<strong>Status:</strong> {{ $contract->status }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6">
|
||||
<strong>Date Début:</strong> {{ $contract->start_date->format('d/m/Y') }}
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<strong>Date Fin:</strong> {{ $contract->end_date ? $contract->end_date->format('d/m/Y') : 'Indéfinie' }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<strong>Montant:</strong> {{ number_format($contract->amount, 2) }} {{ $contract->currency }}
|
||||
</div>
|
||||
@if($contract->notes)
|
||||
<div class="mb-3">
|
||||
<strong>Notes:</strong>
|
||||
<p class="text-muted">{{ $contract->notes }}</p>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Meta Data -->
|
||||
@if($contract->meta->isNotEmpty())
|
||||
<div class="card shadow-sm mb-4">
|
||||
<div class="card-header bg-light">
|
||||
<h5 class="mb-0">Détails Techniques</h5>
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
@foreach($contract->meta as $meta)
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<span>
|
||||
@if($meta->key == 'm365_license_level')
|
||||
<i class="bi bi-microsoft me-1"></i> Niveau Licence M365
|
||||
@elseif($meta->key == 'm365_quantity')
|
||||
<i class="bi bi-people-fill me-1"></i> Nombre de Licences
|
||||
@else
|
||||
{{ $meta->key }}
|
||||
@endif
|
||||
</span>
|
||||
<span class="fw-bold">{{ $meta->value }}</span>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<!-- Documents -->
|
||||
<div class="card shadow-sm mb-4">
|
||||
<div class="card-header bg-light d-flex justify-content-between align-items-center">
|
||||
<h5 class="mb-0">Documents</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if($contract->documents->isEmpty())
|
||||
<p class="text-muted small">Aucun document.</p>
|
||||
@else
|
||||
<ul class="list-unstyled">
|
||||
@foreach($contract->documents as $doc)
|
||||
<li class="mb-2 d-flex justify-content-between align-items-center">
|
||||
<a href="{{ Storage::url($doc->path) }}" target="_blank" class="text-decoration-none text-truncate" style="max-width: 200px;">
|
||||
<i class="bi bi-file-earmark-text"></i> {{ $doc->filename }}
|
||||
</a>
|
||||
@if(auth()->id() == $doc->uploaded_by || auth()->user()->isManager())
|
||||
<form action="{{ route('documents.destroy', $doc) }}" method="POST" class="d-inline" onsubmit="return confirm('Supprimer ?')">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="btn btn-sm btn-link text-danger p-0"><i class="bi bi-trash"></i></button>
|
||||
</form>
|
||||
@endif
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
|
||||
@if(auth()->user()->isManager())
|
||||
<hr>
|
||||
<form action="{{ route('documents.store', $contract) }}" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="mb-2">
|
||||
<label class="form-label small">Ajouter un document</label>
|
||||
<input type="file" name="file" class="form-control form-control-sm" required>
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<input type="text" name="description" placeholder="Description (optionnel)" class="form-control form-control-sm">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-sm btn-success w-100">Uploader</button>
|
||||
</form>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
323
resources/views/cortex/index.blade.php
Normal file
323
resources/views/cortex/index.blade.php
Normal file
@@ -0,0 +1,323 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', 'Cortex XDR')
|
||||
|
||||
@section('content')
|
||||
<div class="mb-4">
|
||||
<!-- Configuration Warning (Server-side check) -->
|
||||
<!-- We can't check config in view easily if controller doesn't pass it,
|
||||
but we'll handle errors in JS -->
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<div>
|
||||
<h5 class="text-muted">Vue d'ensemble de la sécurité</h5>
|
||||
</div>
|
||||
<div>
|
||||
<span class="badge bg-dark border border-secondary p-2" id="api-status-badge">
|
||||
<span class="spinner-border spinner-border-sm text-secondary me-1" role="status" aria-hidden="true" id="status-spinner"></span>
|
||||
<span id="api-status-text">Connexion...</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Loader Overlay -->
|
||||
<div id="loading-overlay" class="text-center py-5">
|
||||
<div class="spinner-border text-primary" style="width: 3rem; height: 3rem;" role="status">
|
||||
<span class="visually-hidden">Loading...</span>
|
||||
</div>
|
||||
<p class="mt-3 text-muted">Chargement des données Cortex XDR en cours...</p>
|
||||
<p class="small text-muted">Cela peut prendre quelques secondes (récupération de ~1000 postes).</p>
|
||||
</div>
|
||||
|
||||
<!-- Main Content (Hidden initially) -->
|
||||
<div id="dashboard-content" class="d-none">
|
||||
<!-- KPI Cards -->
|
||||
<div class="row g-4 mb-4">
|
||||
<!-- Incidents Total -->
|
||||
<div class="col-md-3">
|
||||
<div class="card shadow-sm border-0 h-100">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h6 class="text-muted mb-0">Total Incidents</h6>
|
||||
<div class="icon-shape bg-primary bg-opacity-10 text-primary rounded-circle p-2">
|
||||
<i class="bi bi-bug fs-4"></i>
|
||||
</div>
|
||||
</div>
|
||||
<h2 class="display-6 fw-bold mb-0 text-white" id="incidents-total">-</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Endpoints Total -->
|
||||
<div class="col-md-3">
|
||||
<div class="card shadow-sm border-0 h-100">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h6 class="text-muted mb-0">Total Postes</h6>
|
||||
<div class="icon-shape bg-info bg-opacity-10 text-info rounded-circle p-2">
|
||||
<i class="bi bi-laptop fs-4"></i>
|
||||
</div>
|
||||
</div>
|
||||
<h2 class="display-6 fw-bold mb-0 text-white" id="endpoints-total">-</h2>
|
||||
<div class="mt-2 text-muted small">
|
||||
<i class="bi bi-wifi text-success"></i> <span id="endpoints-connected-sm">-</span> Connectés
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Critical Incidents -->
|
||||
<div class="col-md-3">
|
||||
<div class="card shadow-sm border-0 h-100 position-relative overflow-hidden">
|
||||
<div class="position-absolute top-0 start-0 w-1 pt-1 h-100 bg-danger"></div>
|
||||
<div class="card-body ps-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h6 class="text-danger mb-0">Critiques</h6>
|
||||
<i class="bi bi-lightning-charge-fill text-danger fs-4"></i>
|
||||
</div>
|
||||
<h2 class="display-6 fw-bold mb-0 text-white" id="incidents-critical">-</h2>
|
||||
<small class="text-muted">Incidents nécessitant attention immédiate</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- High Incidents -->
|
||||
<div class="col-md-3">
|
||||
<div class="card shadow-sm border-0 h-100 position-relative overflow-hidden">
|
||||
<div class="position-absolute top-0 start-0 w-1 pt-1 h-100 bg-warning"></div>
|
||||
<div class="card-body ps-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h6 class="text-warning mb-0">Élevés</h6>
|
||||
<i class="bi bi-exclamation-circle-fill text-warning fs-4"></i>
|
||||
</div>
|
||||
<h2 class="display-6 fw-bold mb-0 text-white" id="incidents-high">-</h2>
|
||||
<small class="text-muted">Incidents à traiter rapidement</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Detailed Breakdown Row -->
|
||||
<div class="row g-4">
|
||||
<!-- Recent Incidents Table -->
|
||||
<div class="col-md-8">
|
||||
<div class="card shadow-sm border-0 h-100">
|
||||
<div class="card-header border-bottom-0 bg-transparent py-3">
|
||||
<h5 class="card-title fw-bold text-white mb-0">
|
||||
<i class="bi bi-clock-history me-2 text-primary"></i>Derniers Incidents
|
||||
</h5>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover align-middle mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="ps-4">ID</th>
|
||||
<th>Observed Hosts</th>
|
||||
<th>Sévérité</th>
|
||||
<th>Statut</th>
|
||||
<th>Date</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="incidents-table-body">
|
||||
<!-- Rows injected by JS -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Endpoints Status -->
|
||||
<div class="col-md-4">
|
||||
<div class="card shadow-sm border-0 h-100">
|
||||
<div class="card-header border-bottom-0 bg-transparent py-3">
|
||||
<h5 class="card-title fw-bold text-white mb-0">
|
||||
<i class="bi bi-hdd-network me-2 text-info"></i>État du Parc
|
||||
</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="mb-4">
|
||||
<div class="d-flex justify-content-between mb-1">
|
||||
<span class="text-white">Connectés</span>
|
||||
<span class="text-success fw-bold" id="endpoints-connected">-</span>
|
||||
</div>
|
||||
<div class="progress" style="height: 6px;">
|
||||
<div id="progress-connected" class="progress-bar bg-success" role="progressbar" style="width: 0%"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<div class="d-flex justify-content-between mb-1">
|
||||
<span class="text-white">Déconnectés</span>
|
||||
<span class="text-secondary fw-bold" id="endpoints-disconnected">-</span>
|
||||
</div>
|
||||
<div class="progress" style="height: 6px;">
|
||||
<div id="progress-disconnected" class="progress-bar bg-secondary" role="progressbar" style="width: 0%"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Endpoint Types Breakdown -->
|
||||
<div class="mb-4">
|
||||
<h6 class="text-white small fw-bold mb-2">Répartition par Type</h6>
|
||||
<div class="d-flex flex-wrap gap-2" id="endpoint-types-container">
|
||||
<span class="text-muted small">Chargement...</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-dark border-secondary mt-3 mb-0">
|
||||
<div class="d-flex">
|
||||
<i class="bi bi-info-circle me-2 text-info"></i>
|
||||
<div class="small text-muted">
|
||||
Le parc est majoritairement <strong class="text-white" id="network-status-text">...</strong>.
|
||||
<span id="disconnected-count-text">0</span> machines n'ont pas communiqué récemment.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
fetchData();
|
||||
});
|
||||
|
||||
function fetchData() {
|
||||
fetch("{{ route('cortex.data') }}")
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error('Erreur réseau ou configuration');
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
console.log("Cortex Data Received:", data); // Debug
|
||||
|
||||
// Hide loader, show content
|
||||
document.getElementById('loading-overlay').classList.add('d-none');
|
||||
document.getElementById('dashboard-content').classList.remove('d-none');
|
||||
|
||||
// Update Status Badge
|
||||
const statusText = document.getElementById('api-status-text');
|
||||
const spinner = document.getElementById('status-spinner');
|
||||
if (data.mock) {
|
||||
statusText.innerText = 'Demo Mode';
|
||||
} else {
|
||||
statusText.innerText = 'Connecté';
|
||||
const checkIcon = document.querySelector('.bi-shield-check');
|
||||
if(checkIcon) checkIcon.classList.remove('d-none');
|
||||
}
|
||||
spinner.classList.add('d-none');
|
||||
|
||||
// Update Counters safely
|
||||
document.getElementById('incidents-total').innerText = data.incidents_total || 0;
|
||||
document.getElementById('endpoints-total').innerText = data.endpoints_total || 0;
|
||||
document.getElementById('endpoints-connected-sm').innerText = data.endpoints_connected || 0;
|
||||
document.getElementById('incidents-critical').innerText = data.incidents_critical || 0;
|
||||
document.getElementById('incidents-high').innerText = data.incidents_high || 0;
|
||||
|
||||
// Update Breakdown
|
||||
document.getElementById('endpoints-connected').innerText = data.endpoints_connected || 0;
|
||||
document.getElementById('endpoints-disconnected').innerText = data.endpoints_disconnected || 0;
|
||||
|
||||
// Progress Bars
|
||||
const total = (data.endpoints_total && data.endpoints_total > 0) ? data.endpoints_total : 1;
|
||||
const connPct = ((data.endpoints_connected || 0) / total) * 100;
|
||||
const discPct = ((data.endpoints_disconnected || 0) / total) * 100;
|
||||
|
||||
document.getElementById('progress-connected').style.width = connPct + '%';
|
||||
document.getElementById('progress-disconnected').style.width = discPct + '%';
|
||||
|
||||
// Endpoint Types
|
||||
const typesContainer = document.getElementById('endpoint-types-container');
|
||||
typesContainer.innerHTML = '';
|
||||
if (data.endpoints_types && typeof data.endpoints_types === 'object') {
|
||||
Object.keys(data.endpoints_types).forEach(type => {
|
||||
const count = data.endpoints_types[type];
|
||||
let icon = 'bi-pc-display';
|
||||
if (type.includes('Server')) icon = 'bi-hdd-rack';
|
||||
else if (type.includes('Mobile') || type.includes('Phone')) icon = 'bi-phone';
|
||||
else if (type.includes('Lab') || type.includes('Virtual')) icon = 'bi-box';
|
||||
|
||||
typesContainer.innerHTML += `
|
||||
<div class="d-flex align-items-center bg-dark border border-secondary rounded px-2 py-1">
|
||||
<i class="bi ${icon} me-2 text-muted"></i>
|
||||
<span class="text-white small me-2">${type}</span>
|
||||
<span class="badge bg-secondary rounded-pill">${count}</span>
|
||||
</div>
|
||||
`;
|
||||
});
|
||||
} else {
|
||||
typesContainer.innerHTML = '<span class="text-muted small">Aucune donnée de type</span>';
|
||||
}
|
||||
|
||||
// Info Text
|
||||
|
||||
// Info Text
|
||||
document.getElementById('network-status-text').innerText = connPct > 50 ? 'connecté' : 'déconnecté';
|
||||
document.getElementById('disconnected-count-text').innerText = data.endpoints_disconnected || 0;
|
||||
|
||||
// Render Table
|
||||
const tbody = document.getElementById('incidents-table-body');
|
||||
let tableContent = '';
|
||||
|
||||
if (data.recent_incidents && Array.isArray(data.recent_incidents) && data.recent_incidents.length > 0) {
|
||||
data.recent_incidents.forEach(incident => {
|
||||
const sev = (incident.severity || 'unknown').toString().toLowerCase();
|
||||
let badgeClass = 'light';
|
||||
if (sev === 'critical') badgeClass = 'danger';
|
||||
else if (sev === 'high') badgeClass = 'warning';
|
||||
else if (sev === 'medium') badgeClass = 'info';
|
||||
else if (sev === 'low') badgeClass = 'secondary';
|
||||
|
||||
const dateStr = incident.creation_time ? new Date(incident.creation_time).toLocaleString() : '-';
|
||||
const link = incident.xdr_url || '#';
|
||||
const host = (incident.hosts && incident.hosts.length > 0) ? incident.hosts[0] : 'Unknown Host';
|
||||
const status = incident.status || 'Active';
|
||||
|
||||
tableContent += `
|
||||
<tr>
|
||||
<td class="ps-4 text-white">#${incident.incident_id || '-'}</td>
|
||||
<td>
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="avatar-sm bg-dark rounded-circle me-2 d-flex justify-content-center align-items-center" style="width:30px;height:30px">
|
||||
<i class="bi bi-pc-display text-muted small"></i>
|
||||
</div>
|
||||
<a href="${link}" target="_blank">${host}</a>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span class="badge bg-${badgeClass}">${sev.charAt(0).toUpperCase() + sev.slice(1)}</span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="badge bg-dark border border-secondary">${status}</span>
|
||||
</td>
|
||||
<td class="text-muted">${dateStr}</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
} else {
|
||||
tableContent = `
|
||||
<tr>
|
||||
<td colspan="5" class="text-center py-5 text-muted">
|
||||
<i class="bi bi-check-circle fs-1 d-block mb-3 text-success opacity-50"></i>
|
||||
Aucun incident récent à afficher.
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
}
|
||||
tbody.innerHTML = tableContent;
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
document.getElementById('loading-overlay').innerHTML = `
|
||||
<div class="alert alert-danger">Erreur de chargement: ${error.message}</div>
|
||||
<button class="btn btn-outline-light btn-sm mt-2" onclick="location.reload()">Réessayer</button>
|
||||
`;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endsection
|
||||
208
resources/views/dashboard.blade.php
Normal file
208
resources/views/dashboard.blade.php
Normal file
@@ -0,0 +1,208 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
@section('title', 'Tableau de Bord')
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="row g-4 mb-4">
|
||||
<!-- Stats Cards -->
|
||||
<div class="col-md-3">
|
||||
<div class="card shadow-sm border-start border-4 border-primary">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title text-muted">Nombre de contrats</h5>
|
||||
<h2 class="display-6">{{ $contractStats['total'] }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="card shadow-sm border-start border-4 border-success">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title text-muted">Actifs</h5>
|
||||
<h2 class="display-6">{{ $contractStats['active'] }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="card shadow-sm border-start border-4 border-warning">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title text-muted">Expire bientôt</h5>
|
||||
<h2 class="display-6">{{ $contractStats['expiring_soon'] }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="card shadow-sm border-start border-4 border-danger">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title text-muted">Expirés</h5>
|
||||
<h2 class="display-6">{{ $contractStats['expired'] }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col-12">
|
||||
<div class="card shadow-sm border-0">
|
||||
<div class="card-header border-bottom-0 pt-3 pb-0 d-flex justify-content-between align-items-center">
|
||||
<h5 class="card-title fw-bold text-white mb-0">
|
||||
<i class="bi bi-sticky me-2"></i>Bloc-Note
|
||||
</h5>
|
||||
<small class="text-muted"></small>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="{{ route('dashboard.note.update') }}" method="POST">
|
||||
@csrf
|
||||
<div class="input-group">
|
||||
<textarea name="note" class="form-control" rows="3" placeholder="Écrivez un message ici...">{{ $dashboardNote }}</textarea>
|
||||
<button class="btn btn-warning text-dark" type="submit">Enregistrer</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col-12">
|
||||
<div class="card shadow-sm border-0">
|
||||
<div class="card-header border-bottom-0 pt-4 pb-0">
|
||||
<h5 class="card-title fw-bold text-white mb-0">
|
||||
<i class="bi bi-calendar-event me-2"></i>Prochaines Expirations
|
||||
</h5>
|
||||
<p class="text-muted small mb-0"></p>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if($upcomingContracts->isEmpty())
|
||||
<p class="text-center text-muted py-4">Aucun contrat n'arrive à échéance prochainement.</p>
|
||||
@else
|
||||
<div class="timeline-wrapper">
|
||||
<div class="timeline">
|
||||
@foreach($upcomingContracts as $contract)
|
||||
@php
|
||||
$diffInDays = now()->startOfDay()->diffInDays($contract->end_date->startOfDay(), false);
|
||||
$statusClass = 'normal';
|
||||
|
||||
if ($diffInDays < 0) {
|
||||
$statusClass = 'expired';
|
||||
} elseif ($diffInDays < 30) {
|
||||
$statusClass = 'urgent';
|
||||
} elseif ($diffInDays < 90) {
|
||||
$statusClass = 'soon';
|
||||
}
|
||||
@endphp
|
||||
<div class="timeline-item {{ $statusClass }}">
|
||||
<!-- Date Label -->
|
||||
<div class="timeline-date">
|
||||
{{ $contract->end_date->format('d M Y') }}
|
||||
<br>
|
||||
<small class="{{ $diffInDays < 0 ? 'text-secondary' : ($diffInDays < 30 ? 'text-danger' : 'text-muted') }}">
|
||||
@if($diffInDays < 0)
|
||||
Expiré
|
||||
@elseif($diffInDays == 0)
|
||||
Aujourd'hui
|
||||
@else
|
||||
J-{{ $diffInDays }}
|
||||
@endif
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<!-- Dot on the line -->
|
||||
<div class="timeline-dot" title="{{ $contract->status }}"></div>
|
||||
|
||||
<!-- Content Below -->
|
||||
<a href="{{ route('contracts.show', $contract) }}" class="timeline-content text-start">
|
||||
<h6 class="text-truncate" title="{{ $contract->name }}">{{ $contract->name }}</h6>
|
||||
<small class="d-block text-secondary">{{ $contract->provider }}</small>
|
||||
<span class="badge rounded-pill bg-light text-dark border mt-1">
|
||||
{{ number_format($contract->amount, 0, ',', ' ') }} {{ $contract->currency }}
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<!-- Links Section -->
|
||||
<div class="col-md-12 mb-4">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-header border-bottom-0">
|
||||
<h5 class="mb-0 text-white">Ressources</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex flex-wrap gap-3">
|
||||
@forelse($links as $link)
|
||||
<a href="{{ $link->url }}" target="_blank" class="btn btn-outline-{{ $link->color ?? 'primary' }} d-flex align-items-center gap-2">
|
||||
@if($link->icon) <i class="bi {{ $link->icon }}"></i> @endif
|
||||
{{ $link->title }}
|
||||
</a>
|
||||
@empty
|
||||
<p class="text-muted mb-0">Aucun lien configuré.</p>
|
||||
@endforelse
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<!-- Types Chart / Distribution (simplified list here) -->
|
||||
<div class="col-md-6 mb-4">
|
||||
<div class="card h-100 shadow-sm">
|
||||
<div class="card-header border-bottom-0">
|
||||
<h5 class="mb-0 text-white">Répartition par Type</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<ul class="list-group list-group-flush">
|
||||
@foreach($contractStats['by_type'] as $type => $stat)
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
||||
{{ ucfirst(str_replace('_', ' ', $type)) }}
|
||||
<span class="badge bg-secondary pill">{{ $stat->count }}</span>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Recent Activity -->
|
||||
<div class="col-md-6 mb-4">
|
||||
<div class="card h-100 shadow-sm">
|
||||
<div class="card-header border-bottom-0">
|
||||
<h5 class="mb-0 text-white">Dernières Activités (Audit Logs)</h5>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped mb-0 small">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Action</th>
|
||||
<th>Utilisateur</th>
|
||||
<th>Temps</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($recentLogs as $log)
|
||||
<tr>
|
||||
<td>
|
||||
<span class="d-block text-truncate" style="max-width: 150px;" title="{{ $log->description }}">
|
||||
{{ $log->action }}
|
||||
</span>
|
||||
</td>
|
||||
<td>{{ $log->user->name ?? 'Système' }}</td>
|
||||
<td>{{ $log->created_at->diffForHumans() }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
15
resources/views/emails/contracts/expiring.blade.php
Normal file
15
resources/views/emails/contracts/expiring.blade.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<h1>Alertes de Contrats</h1>
|
||||
|
||||
<p>Les contrats suivants arrivent à échéance dans les 30 jours :</p>
|
||||
|
||||
<ul>
|
||||
@foreach($expiringContracts as $contract)
|
||||
<li>
|
||||
<strong>{{ $contract->name }}</strong> ({{ $contract->provider }}) -
|
||||
Expire le : {{ \Carbon\Carbon::parse($contract->end_date)->format('d/m/Y') }}
|
||||
<a href="{{ route('contracts.show', $contract->id) }}">Voir</a>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
|
||||
<p>Merci,<br>DSIGEST</p>
|
||||
121
resources/views/layouts/app.blade.php
Normal file
121
resources/views/layouts/app.blade.php
Normal file
@@ -0,0 +1,121 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{{ config('app.name', 'DSIGEST') }}</title>
|
||||
@vite(['resources/css/app.scss', 'resources/js/app.js'])
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
<!-- Sidebar -->
|
||||
<nav class="sidebar">
|
||||
<div class="sidebar-brand">
|
||||
<a class="text-decoration-none" href="{{ route('dashboard') }}">
|
||||
<i class="bi bi-grid-fill me-2"></i> {{ config('app.name', 'DSIGEST') }}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-column py-3">
|
||||
<div class="sidebar-heading">Menu</div>
|
||||
|
||||
<a class="nav-link {{ request()->routeIs('dashboard') ? 'active' : '' }}" href="{{ route('dashboard') }}">
|
||||
<i class="bi bi-speedometer2"></i> Dashboard
|
||||
</a>
|
||||
|
||||
<a class="nav-link {{ request()->routeIs('contracts.*') ? 'active' : '' }}" href="{{ route('contracts.index') }}">
|
||||
<i class="bi bi-file-earmark-text"></i> Contrats
|
||||
</a>
|
||||
|
||||
<a class="nav-link {{ request()->routeIs('municipalities.*') ? 'active' : '' }}" href="{{ route('municipalities.index') }}">
|
||||
<i class="bi bi-building"></i> Communes
|
||||
</a>
|
||||
|
||||
<a class="nav-link {{ request()->routeIs('cortex.*') ? 'active' : '' }}" href="{{ route('cortex.index') }}">
|
||||
<i class="bi bi-shield-lock"></i> Cortex XDR
|
||||
</a>
|
||||
|
||||
@auth
|
||||
@if(auth()->user()->isAdmin())
|
||||
<div class="sidebar-heading mt-3">Administration</div>
|
||||
|
||||
<a class="nav-link {{ request()->routeIs('admin.municipalities.*') ? 'active' : '' }}" href="{{ route('admin.municipalities.index') }}">
|
||||
<i class="bi bi-gear"></i> Gérer Communes
|
||||
</a>
|
||||
|
||||
<a class="nav-link {{ request()->routeIs('admin.license_levels.*') ? 'active' : '' }}" href="{{ route('admin.license_levels.index') }}">
|
||||
<i class="bi bi-microsoft"></i> Licences M365
|
||||
</a>
|
||||
|
||||
<a class="nav-link {{ request()->routeIs('admin.users.*') ? 'active' : '' }}" href="{{ route('admin.users.index') }}">
|
||||
<i class="bi bi-people"></i> Utilisateurs
|
||||
</a>
|
||||
|
||||
<a class="nav-link {{ request()->routeIs('admin.links.*') ? 'active' : '' }}" href="{{ route('admin.links.index') }}">
|
||||
<i class="bi bi-link-45deg"></i> Gérer Liens
|
||||
</a>
|
||||
@endif
|
||||
@endauth
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- Main Content -->
|
||||
<main class="main-content">
|
||||
<!-- Topbar -->
|
||||
<header class="topbar justify-content-between">
|
||||
<div>
|
||||
<!-- Breadcrumbs or Title could go here -->
|
||||
<h4 class="mb-0 text-white">@yield('title', 'Dashboard')</h4>
|
||||
</div>
|
||||
|
||||
<div class="d-flex align-items-center">
|
||||
@guest
|
||||
<a class="btn btn-primary btn-sm me-2" href="{{ route('login') }}">Connexion</a>
|
||||
<a class="btn btn-outline-light btn-sm" href="{{ route('register') }}">Inscription</a>
|
||||
@else
|
||||
<div class="dropdown">
|
||||
<a class="d-flex align-items-center text-white text-decoration-none dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
|
||||
<i class="bi bi-person-circle fs-4 me-2"></i>
|
||||
<span>{{ Auth::user()->name }}</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-end bg-dark border-secondary">
|
||||
<li>
|
||||
<form action="{{ route('logout') }}" method="POST">
|
||||
@csrf
|
||||
<button type="submit" class="dropdown-item text-light hover-primary">
|
||||
<i class="bi bi-box-arrow-right me-2"></i> Déconnexion
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@endguest
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- Page Content -->
|
||||
<div class="container-fluid px-4 pb-4">
|
||||
@if(session('success'))
|
||||
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
||||
{{ session('success') }}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||
</div>
|
||||
@endif
|
||||
@if(session('error'))
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
{{ session('error') }}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@yield('content')
|
||||
</div>
|
||||
|
||||
<!-- Footer -->
|
||||
<footer class="mt-auto py-3 border-top border-secondary text-center small text-muted">
|
||||
© {{ date('Y') }} {{ config('app.name', 'DSIGEST') }}. Tous droits réservés.
|
||||
</footer>
|
||||
</main>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
30
resources/views/municipalities/index.blade.php
Normal file
30
resources/views/municipalities/index.blade.php
Normal file
@@ -0,0 +1,30 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<h2 class="mb-4">Communes de l'Agglomération</h2>
|
||||
|
||||
<div class="row row-cols-1 row-cols-md-3 g-4">
|
||||
@foreach($municipalities as $municipality)
|
||||
<div class="col">
|
||||
<div class="card h-100 shadow-sm hover-shadow">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">{{ $municipality->name }}</h5>
|
||||
<p class="card-text text-muted">{{ $municipality->zip_code }}</p>
|
||||
</div>
|
||||
<div class="card-footer bg-white border-top-0">
|
||||
<a href="{{ route('municipalities.show', $municipality) }}" class="btn btn-primary w-100">Voir la fiche</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.hover-shadow:hover {
|
||||
box-shadow: 0 .5rem 1rem rgba(0,0,0,.15)!important;
|
||||
transition: box-shadow 0.3s ease-in-out;
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
90
resources/views/municipalities/show.blade.php
Normal file
90
resources/views/municipalities/show.blade.php
Normal file
@@ -0,0 +1,90 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="mb-4 d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<h2 class="mb-0">{{ $municipality->name }} <span class="text-muted fs-4">({{ $municipality->zip_code }})</span></h2>
|
||||
<p class="text-muted">Fiche de synthèse</p>
|
||||
</div>
|
||||
<a href="{{ route('municipalities.index') }}" class="btn btn-outline-secondary">
|
||||
<i class="bi bi-arrow-left"></i> Retour
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- M365 Statistics Card -->
|
||||
<div class="card shadow-sm mb-5 border-primary">
|
||||
<div class="card-header bg-primary text-white d-flex align-items-center">
|
||||
<i class="bi bi-microsoft fs-4 me-2"></i>
|
||||
<h5 class="mb-0">Licences Microsoft 365</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row text-center">
|
||||
@foreach($m365Stats as $level => $count)
|
||||
@if($count > 0)
|
||||
<div class="col-md-2 mb-3">
|
||||
<div class="p-3 border rounded bg-light">
|
||||
<div class="text-muted small text-uppercase fw-bold mb-1">{{ $level }}</div>
|
||||
<div class="fs-2 fw-bold text-primary">{{ $count }}</div>
|
||||
<div class="small text-muted">Licences</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
@if(array_sum($m365Stats) == 0)
|
||||
<p class="text-center text-muted my-3">Aucune licence Microsoft 365 associée pour le moment.</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- All Contracts List -->
|
||||
<h4 class="mb-3">Liste des contrats</h4>
|
||||
|
||||
@if($contracts->isEmpty())
|
||||
<div class="alert alert-info">
|
||||
Aucun contrat associé à cette commune.
|
||||
</div>
|
||||
@else
|
||||
<div class="card shadow-sm">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover align-middle mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Nom</th>
|
||||
<th>Fournisseur</th>
|
||||
<th>Type</th>
|
||||
<th>État</th>
|
||||
<th>Date fin</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($contracts as $contract)
|
||||
<tr>
|
||||
<td>{{ $contract->name }}</td>
|
||||
<td>{{ $contract->provider }}</td>
|
||||
<td><span class="badge bg-secondary">{{ $contract->type }}</span></td>
|
||||
<td>
|
||||
@if($contract->status == 'active')
|
||||
<span class="badge bg-success">Actif</span>
|
||||
@elseif($contract->status == 'expired')
|
||||
<span class="badge bg-danger">Expiré</span>
|
||||
@else
|
||||
<span class="badge bg-warning text-dark">{{ $contract->status }}</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $contract->end_date ? $contract->end_date->format('d/m/Y') : '-' }}</td>
|
||||
<td>
|
||||
<a href="{{ route('contracts.show', $contract) }}" class="btn btn-sm btn-outline-primary">Voir</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
@endsection
|
||||
277
resources/views/welcome.blade.php
Normal file
277
resources/views/welcome.blade.php
Normal file
File diff suppressed because one or more lines are too long
8
routes/console.php
Normal file
8
routes/console.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
Artisan::command('inspire', function () {
|
||||
$this->comment(Inspiring::quote());
|
||||
})->purpose('Display an inspiring quote');
|
||||
76
routes/web.php
Normal file
76
routes/web.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use App\Http\Controllers\AuthController;
|
||||
use App\Http\Controllers\DashboardController;
|
||||
use App\Http\Controllers\ContractController;
|
||||
use App\Http\Controllers\DocumentController;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Web Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register web routes for your application. These
|
||||
| routes are loaded by the RouteServiceProvider and all of them will
|
||||
| be assigned to the "web" middleware group. Make something great!
|
||||
|
|
||||
*/
|
||||
|
||||
Route::get('/', function () {
|
||||
return redirect()->route('dashboard');
|
||||
});
|
||||
|
||||
// Auth
|
||||
Route::get('/login', [AuthController::class, 'showLogin'])->name('login');
|
||||
Route::post('/login', [AuthController::class, 'login']);
|
||||
Route::get('/register', [AuthController::class, 'showRegister'])->name('register');
|
||||
Route::post('/register', [AuthController::class, 'register']);
|
||||
Route::post('/logout', [AuthController::class, 'logout'])->name('logout');
|
||||
|
||||
// Dashboard & Resources
|
||||
Route::middleware(['auth', 'active'])->group(function () {
|
||||
Route::get('/dashboard', [DashboardController::class, 'index'])->name('dashboard');
|
||||
Route::post('/dashboard/note', [DashboardController::class, 'updateNote'])->name('dashboard.note.update');
|
||||
|
||||
Route::resource('contracts', ContractController::class);
|
||||
|
||||
// Municipalities
|
||||
Route::resource('municipalities', \App\Http\Controllers\MunicipalityController::class)->only(['index', 'show']);
|
||||
|
||||
// Document Upload
|
||||
Route::post('contracts/{contract}/documents', [DocumentController::class, 'store'])->name('documents.store');
|
||||
Route::delete('documents/{document}', [DocumentController::class, 'destroy'])->name('documents.destroy');
|
||||
|
||||
// Logs (Admin Only)
|
||||
// Route::get('logs', ...)
|
||||
|
||||
// Cortex XDR
|
||||
Route::get('/cortex', [App\Http\Controllers\CortexXdrController::class, 'index'])->name('cortex.index');
|
||||
Route::get('/cortex/data', [App\Http\Controllers\CortexXdrController::class, 'getData'])->name('cortex.data');
|
||||
});
|
||||
|
||||
// Admin Approval Routes (Example)
|
||||
Route::middleware(['auth', 'active', 'admin'])->prefix('admin')->name('admin.')->group(function () {
|
||||
Route::get('/users', function () {
|
||||
// List pending users
|
||||
})->name('users.index');
|
||||
|
||||
// Admin Municipalities
|
||||
Route::get('/municipalities', [\App\Http\Controllers\Admin\MunicipalityController::class, 'index'])->name('municipalities.index');
|
||||
Route::post('/municipalities/{municipality}/toggle', [\App\Http\Controllers\Admin\MunicipalityController::class, 'toggle'])->name('municipalities.toggle');
|
||||
|
||||
// Admin License Levels
|
||||
Route::get('/license-levels', [\App\Http\Controllers\Admin\LicenseLevelController::class, 'index'])->name('license_levels.index');
|
||||
Route::post('/license-levels', [\App\Http\Controllers\Admin\LicenseLevelController::class, 'store'])->name('license_levels.store');
|
||||
Route::post('/license-levels/{licenseLevel}/toggle', [\App\Http\Controllers\Admin\LicenseLevelController::class, 'toggle'])->name('license_levels.toggle');
|
||||
Route::delete('/license-levels/{licenseLevel}', [\App\Http\Controllers\Admin\LicenseLevelController::class, 'destroy'])->name('license_levels.destroy');
|
||||
|
||||
// Admin Links
|
||||
Route::get('/links', [\App\Http\Controllers\Admin\LinkController::class, 'index'])->name('links.index');
|
||||
Route::post('/links', [\App\Http\Controllers\Admin\LinkController::class, 'store'])->name('links.store');
|
||||
Route::get('/links/{link}/edit', [\App\Http\Controllers\Admin\LinkController::class, 'edit'])->name('links.edit');
|
||||
Route::put('/links/{link}', [\App\Http\Controllers\Admin\LinkController::class, 'update'])->name('links.update');
|
||||
Route::post('/links/{link}/toggle', [\App\Http\Controllers\Admin\LinkController::class, 'toggle'])->name('links.toggle');
|
||||
Route::delete('/links/{link}', [\App\Http\Controllers\Admin\LinkController::class, 'destroy'])->name('links.destroy');
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user