Logo du site, favicon et contrôle des inscriptions
SiteSettingsService : persistance JSON dans storage/app/site_settings.json
(pas de migration DB — survit aux mises à jour sans table supplémentaire)
Logo :
- Upload admin (PNG/JPG/SVG/WebP, max 2 Mo) → storage/app/public/site/logo.{ext}
- Favicon <link rel="icon"> injecté dans app.blade.php et guest.blade.php
- Logo affiché dans la barre de navigation (h-8, object-contain)
- Logo affiché sur la page de connexion (guest layout)
- Page d'accueil welcome.blade.php entièrement refaite : logo + bouton connexion
(remplacement du template Laravel par défaut)
- Suppression du logo possible depuis Admin > Paramètres du site
Inscriptions :
- Désactivées par défaut (registration_enabled=false dans site_settings.json)
- RegisteredUserController : redirige vers /login si inscription désactivée
(GET /register → redirect + message ; POST /register → abort 403)
- Page d'accueil : bouton "Créer un compte" masqué si inscriptions désactivées
- Admin > Paramètres du site : toggle checkbox pour activer/désactiver
AppServiceProvider : partage $siteLogoUrl et $registrationEnabled avec toutes les vues
Navigation : lien "Paramètres du site" en bas du menu Administration
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
<x-app-layout>
|
||||
<x-slot name="header">
|
||||
<h2 class="text-xl font-semibold text-gray-800">Paramètres du site</h2>
|
||||
</x-slot>
|
||||
|
||||
<div class="py-8 max-w-2xl mx-auto px-4 sm:px-6 lg:px-8 space-y-6">
|
||||
|
||||
@if(session('success'))
|
||||
<div class="p-4 bg-green-50 border border-green-200 text-green-800 rounded-md">{{ session('success') }}</div>
|
||||
@endif
|
||||
|
||||
{{-- Logo --}}
|
||||
<div class="bg-white shadow rounded-lg p-6 space-y-5">
|
||||
<h3 class="text-sm font-semibold text-gray-700 uppercase tracking-wide">Logo du site</h3>
|
||||
|
||||
@if($logoUrl)
|
||||
<div class="flex items-center gap-6">
|
||||
<img src="{{ $logoUrl }}" alt="Logo actuel" class="h-20 w-auto object-contain rounded border border-gray-200 p-2">
|
||||
<div>
|
||||
<p class="text-sm text-gray-600 mb-2">Logo actuel</p>
|
||||
<form method="POST" action="{{ route('admin.parametres.logo.delete') }}"
|
||||
x-data @submit.prevent="if(confirm('Supprimer le logo ?')) $el.submit()">
|
||||
@csrf @method('DELETE')
|
||||
<button type="submit" class="text-sm text-red-500 hover:text-red-700">Supprimer</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<p class="text-sm text-gray-400">Aucun logo configuré — le nom de l'application est affiché.</p>
|
||||
@endif
|
||||
|
||||
<form method="POST" action="{{ route('admin.parametres.logo.update') }}"
|
||||
enctype="multipart/form-data" class="space-y-4">
|
||||
@csrf
|
||||
<div>
|
||||
<label for="logo" class="block text-sm font-medium text-gray-700 mb-1">
|
||||
{{ $logoUrl ? 'Remplacer le logo' : 'Téléverser un logo' }}
|
||||
</label>
|
||||
<input type="file" id="logo" name="logo" accept="image/*"
|
||||
class="block w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-medium file:bg-indigo-50 file:text-indigo-700 hover:file:bg-indigo-100">
|
||||
<p class="mt-1 text-xs text-gray-400">PNG, JPG, SVG ou WebP · max 2 Mo · format recommandé : carré ou paysage, fond transparent</p>
|
||||
@error('logo') <p class="mt-1 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
<button type="submit"
|
||||
class="px-5 py-2 bg-indigo-600 text-white text-sm font-medium rounded-md hover:bg-indigo-700">
|
||||
Enregistrer le logo
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{{-- Inscriptions --}}
|
||||
<div class="bg-white shadow rounded-lg p-6 space-y-4">
|
||||
<h3 class="text-sm font-semibold text-gray-700 uppercase tracking-wide">Inscriptions</h3>
|
||||
<p class="text-sm text-gray-500">
|
||||
Autorise ou non les visiteurs à créer un compte via la page d'inscription publique.
|
||||
Quand désactivées, seul un administrateur peut créer des comptes (via la gestion des utilisateurs).
|
||||
</p>
|
||||
|
||||
<form method="POST" action="{{ route('admin.parametres.update') }}">
|
||||
@csrf
|
||||
<label class="flex items-center gap-3 cursor-pointer">
|
||||
<input type="hidden" name="registration_enabled" value="0">
|
||||
<input type="checkbox" name="registration_enabled" value="1"
|
||||
{{ $registrationEnabled ? 'checked' : '' }}
|
||||
class="w-4 h-4 text-indigo-600 border-gray-300 rounded focus:ring-indigo-500">
|
||||
<span class="text-sm text-gray-700">Autoriser l'inscription de nouveaux comptes</span>
|
||||
</label>
|
||||
<div class="mt-4">
|
||||
<button type="submit"
|
||||
class="px-5 py-2 bg-indigo-600 text-white text-sm font-medium rounded-md hover:bg-indigo-700">
|
||||
Enregistrer
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</x-app-layout>
|
||||
@@ -5,7 +5,11 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
|
||||
<title>{{ config('app.name', 'Laravel') }}</title>
|
||||
<title>{{ config('app.name', 'MesRelevés') }}</title>
|
||||
|
||||
@if($siteLogoUrl)
|
||||
<link rel="icon" href="{{ $siteLogoUrl }}">
|
||||
@endif
|
||||
|
||||
<!-- Fonts -->
|
||||
<link rel="preconnect" href="https://fonts.bunny.net">
|
||||
|
||||
@@ -5,7 +5,11 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
|
||||
<title>{{ config('app.name', 'Laravel') }}</title>
|
||||
<title>{{ config('app.name', 'MesRelevés') }}</title>
|
||||
|
||||
@if($siteLogoUrl)
|
||||
<link rel="icon" href="{{ $siteLogoUrl }}">
|
||||
@endif
|
||||
|
||||
<!-- Fonts -->
|
||||
<link rel="preconnect" href="https://fonts.bunny.net">
|
||||
@@ -16,9 +20,13 @@
|
||||
</head>
|
||||
<body class="font-sans text-gray-900 antialiased">
|
||||
<div class="min-h-screen flex flex-col sm:justify-center items-center pt-6 sm:pt-0 bg-gray-100">
|
||||
<div>
|
||||
<div class="mb-2">
|
||||
<a href="/">
|
||||
<x-application-logo class="w-20 h-20 fill-current text-gray-500" />
|
||||
@if($siteLogoUrl)
|
||||
<img src="{{ $siteLogoUrl }}" alt="{{ config('app.name') }}" class="h-16 w-auto object-contain">
|
||||
@else
|
||||
<x-application-logo class="w-16 h-16 fill-current text-gray-400" />
|
||||
@endif
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -4,8 +4,13 @@
|
||||
<div class="flex">
|
||||
<!-- Logo -->
|
||||
<div class="shrink-0 flex items-center">
|
||||
<a href="{{ route('dashboard') }}" class="font-semibold text-gray-800 text-lg">
|
||||
MesRelevés
|
||||
<a href="{{ route('dashboard') }}" class="flex items-center">
|
||||
@if($siteLogoUrl)
|
||||
<img src="{{ $siteLogoUrl }}" alt="{{ config('app.name') }}"
|
||||
class="h-8 w-auto object-contain max-w-[160px]">
|
||||
@else
|
||||
<span class="font-semibold text-gray-800 text-lg">{{ config('app.name') }}</span>
|
||||
@endif
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -58,6 +63,10 @@
|
||||
class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-50">Types de sources</a>
|
||||
<a href="{{ route('admin.lieu-types.index') }}"
|
||||
class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-50">Types de lieux</a>
|
||||
<div class="border-t border-gray-100 mt-1 pt-1">
|
||||
<a href="{{ route('admin.parametres') }}"
|
||||
class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-50">Paramètres du site</a>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user