F
Filament2mo ago
jenno

Frontend page not get header in filament

can anyone please help me out i didn't get header layout on my product page <x-filament-panels::page> <div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6"> @foreach ($products as $product) <div class="bg-white p-4 rounded-lg shadow-lg hover:shadow-xl transition-shadow duration-200"> <div class="w-full h-48 bg-gray-200 rounded-lg overflow-hidden mb-4"> <img src="{{ url('storage/' . $product->image) }}" alt="{{ $product->name }}" class="w-full h-full object-cover"> </div> <h3 class="text-xl font-semibold text-gray-900">{{ $product->name }}</h3> <p class="text-lg text-gray-700 mt-2">${{ number_format($product->price, 2) }}</p> <p class="text-sm text-gray-500 mt-2">{{ \Illuminate\Support\Str::limit($product->description, 100) }}</p>
<!-- Add to Cart Form --> <form wire:submit.prevent="addCart({{ $product->id }})" class="mt-4"> @csrf <input type="hidden" name="product_id" value="{{ $product->id }}"> <button type="submit" class="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600 transition"> Add to Cart </button> </form> </div> @endforeach </div> <!-- Display cart Livewire component -->
</x-filament-panels::page> product blade class Product extends Page { protected static ?string $navigationIcon = 'heroicon-o-document-text'; protected static string $view = 'filament.app.pages.product'; protected $products;
public function render(): View { $products = ModelsProduct::all(); return view(static::$view, [ 'products' => $products, ]); }
} product page
3 Replies
!Jaeger!
!Jaeger!2mo ago
You are using the Filament page component <x-filament-panels::page>, but it seems like you might be missing a section for the header. Filament typically allows you to define headers for your page via the header method or section.
jenno
jennoOP2mo ago
okay so where can i add header section
!Jaeger!
!Jaeger!2mo ago
To add a header section in your Filament product page, you can either use the header() method in your page class, where you return a string like 'product page' to display as the page title or you can define a custom header directly in your blade template using @section('header'), which allows you to add custom HTML content, like a <h1>tag or additional styles
Want results from more Discord servers?
Add your server