Template System

The template system provides flexible customization options:

Template Structure

resources/views/
├── components/              # Component views
│   ├── countdown.blade.php  # Countdown timer component
│   └── status.blade.php     # Status indicator component
├── templates/               # Template views
│   ├── base.blade.php       # Base template (parent)
│   ├── default.blade.php    # Default theme
│   └── modern.blade.php     # Modern theme

View Namespacing

// Register views in ServiceProvider
public function boot(): void
{
    $this->loadViewsFrom(__DIR__.'/../resources/views', 'curtain');
}

// Usage in templates
@extends('curtain::templates.base')
@include('curtain::components.countdown')

Component Structure

// components/countdown.blade.php
<div class="countdown-container">
    <!-- Component content -->
</div>

// components/status.blade.php
<div class="status-indicator">
    <!-- Status content -->
</div>

Template Inheritance

// templates/default.blade.php
@extends('curtain::templates.base')

@section('content')
    @include('curtain::components.status')
    @include('curtain::components.countdown')
@endsection

Customization Workflow

# Publish views for customization
php artisan vendor:publish --tag="curtain-views"

# Views will be copied to
resources/views/vendor/curtain/

This structure promotes:

  • Clear separation of concerns

  • Easy component reusability

  • Consistent view organization

  • Simple customization path

Last updated