Commit a26be026 authored by Mahmoud Aglan's avatar Mahmoud Aglan

Fix website builder audit issues — missing $sections + forbidden href=#

- PublicEventController: pass $sections to views (navbar/footer crash without it)
- Navbar: replace href="#" with href="#section-hero" (forbidden pattern)
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 44c8d8aa
......@@ -3,12 +3,15 @@
namespace App\Http\Controllers;
use App\Domain\Event\Models\Event;
use App\Domain\Website\Services\WebsiteSectionService;
class PublicEventController extends Controller
{
public function index(string $slug)
public function index(string $slug, WebsiteSectionService $sectionService)
{
$academy = app('current_academy');
$settings = app('website_settings');
$sections = $sectionService->getEnabled($academy);
$events = Event::withoutGlobalScopes()
->where('academy_id', $academy->id)
......@@ -17,14 +20,14 @@ public function index(string $slug)
->orderByDesc('starts_at')
->paginate(12);
$settings = app('website_settings');
return view('website.events.index', compact('academy', 'events', 'settings'));
return view('website.events.index', compact('academy', 'events', 'settings', 'sections'));
}
public function show(string $slug, string $eventSlug)
public function show(string $slug, string $eventSlug, WebsiteSectionService $sectionService)
{
$academy = app('current_academy');
$settings = app('website_settings');
$sections = $sectionService->getEnabled($academy);
$event = Event::withoutGlobalScopes()
->where('academy_id', $academy->id)
......@@ -33,8 +36,6 @@ public function show(string $slug, string $eventSlug)
->with(['cover', 'gallery', 'facility'])
->firstOrFail();
$settings = app('website_settings');
return view('website.events.show', compact('academy', 'event', 'settings'));
return view('website.events.show', compact('academy', 'event', 'settings', 'sections'));
}
}
......@@ -2,7 +2,7 @@
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex items-center justify-between h-20">
{{-- Logo + Name --}}
<a href="#" class="flex items-center gap-3 group">
<a href="#section-hero" class="flex items-center gap-3 group">
@if($academy->logo_path)
<img src="{{ asset('storage/' . $academy->logo_path) }}"
alt="{{ $academy->name_ar }}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment