定制 przwl/cine-reserve 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

przwl/cine-reserve

Composer 安装命令:

composer require przwl/cine-reserve

包简介

A seamless, user-friendly Filament plugin for adding interactive movie seat selection and booking functionality to any Laravel application.

README 文档

README

A seamless, user-friendly plugin for adding interactive movie seat selection and booking functionality to any Laravel application.

🎬 Features

  • Interactive Seat Selection: Beautiful, Customizable animated seat selection interface
  • Movie Information Display: Showcase movie details.
  • Customizable Colors: Choose seat colors for booked, available and selected seats.
  • Dynamic Layout: Configure rows and seats per row via config
  • Maximum Selection Limit: Set limits on seat selection per session
  • Pricing Display: Built-in pricing UI with price per seat and total calculation
  • Dark Mode Support: Fully supports Filament's dark mode
  • Extensible: Easy to extend and customize

Screenshots

Light Mode

CineReserve Light Mode

Dark Mode

CineReserve Dark Mode

📦 Installation

Install via Composer

composer require przwl/cine-reserve

Register Plugin

In AdminPanelProvider.php:

Register the plugin from ->plugins([])

use Przwl\CineReserve\Filament\CineReserve;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            CineReserve::make(),
        ]);
}

Publish Config

php artisan vendor:publish --tag=cine-reserve-config

⚙️ Quick Configuration

Edit config/cine-reserve.php:

// Navigation
'register_navigation' => false,        // Show/hide navigation item

// Movie Information
'show_movie_information' => true,      // Show/hide movie information component
'movie_information_fields' => [
    'poster' => true,
    'title' => true,
    'genre' => true,
    'duration' => true,
    'rating' => true,
    'date' => true,
    'start_time' => true,
    'end_time' => true,
    'theater' => true,
],

// Screen & Layout
'show_screen' => true,                 // Show/hide screen indicator
'select_seats_title_position' => 'left', // 'left', 'center', or 'right'

// Seat layout
'rows' => ['A', 'B', 'C', 'D', 'E'],
'seats_per_row' => 8,

// Maximum seats per selection (null = unlimited)
'max_selection_limit' => null,

// Seat colors
'seat_colors' => [
    'available' => 'green',
    'selected' => 'red',
    'booked' => 'gray',
],

// Pricing configuration
'price_per_seat' => 10.00,            // Price per seat (all seats same price)
'show_price_per_seat' => true,         // Display price per seat in UI
'currency_symbol' => '$',              // Currency symbol for price display

🚀 Quick Start

1. Create Custom SelectSeats Page

php artisan make:filament-page CustomSelectSeats --type=custom

2. Extend SelectSeats Class

namespace App\Filament\Pages;

use Przwl\CineReserve\Filament\Pages\SelectSeats;
use App\Models\Movie;
use App\Models\Showtime;
use App\Models\Booking;
use Illuminate\Support\Facades\Storage;

class CustomSelectSeats extends SelectSeats
{
    public ?int $showtimeId = null;
    public $total = 0;

    public function mount(?int $showtimeId = null): void
    {
        parent::mount();
        
        if ($showtimeId) {
            $this->showtimeId = $showtimeId;
            $this->loadShowtimeData($showtimeId);
        }
    }

    protected function loadShowtimeData(int $showtimeId): void
    {
        $showtime = Showtime::with('movie')->findOrFail($showtimeId);
        $movie = $showtime->movie;

        // Set movie information
        $this->movieTitle = $movie->title;
        $this->moviePosterUrl = $movie->poster_url ? Storage::disk('public')->url($movie->poster_url) : null;
        $this->movieGenre = $movie->genre;
        $this->movieDuration = $movie->duration . ' min';
        $this->movieRating = $movie->rating;
        $this->movieDate = $showtime->date->format('F j, Y');
        $this->movieStartTime = \Carbon\Carbon::parse($showtime->start_time)->format('g:i A');
        $this->movieEndTime = \Carbon\Carbon::parse($showtime->end_time)->format('g:i A');
        $this->movieTheater = $showtime->theater_name;

        // Load booked seats
        $this->bookedSeats = Booking::where('showtime_id', $showtimeId)
            ->where('status', '!=', 'cancelled')
            ->get()
            ->pluck('seat_ids')
            ->flatten()
            ->unique()
            ->values()
            ->toArray();
    }


    public function proceed(): void
    {
        if (empty($this->selectedSeats)) {
            Notification::make()
                ->title('Please select at least one seat')
                ->warning()
                ->send();
            return;
        }

        $this->calculateTotal();
        parent::proceed();
    }

    protected function handleBooking(array $selectedSeatDetails): void
    {
        // Create booking
        $booking = Booking::create([
            'showtime_id' => $this->showtimeId,
            'user_id' => Auth::id(),
            'seat_ids' => $this->selectedSeats,
            'total_amount' => $this->total,
            'status' => 'pending',
        ]);

        $this->selectedSeats = [];
        $this->total = 0;

        Notification::make()
            ->title('Seats booked successfully')
            ->success()
            ->send();
    }
}

📸 Preview

Video Demonstration

CineReserve Demo

📖 Complete Integration Guide

For detailed integration instructions, database migrations, models, and advanced customization, see the Integration Guide.

💰 Pricing Feature

CineReserve includes a built-in pricing display system that shows:

  • Total Price: Automatically calculated based on selected seats
  • Price Per Seat: Configurable via config
  • Selected Seat Details: Displays all selected seat labels (e.g., A1, A2, B3)
  • Currency Formatting: Customizable currency symbol

Pricing Configuration

Configure pricing in config/cine-reserve.php:

'price_per_seat' => 10.00,        // Default price per seat
'show_price_per_seat' => true,     // Show/hide price per seat in UI
'currency_symbol' => '$',          // Currency symbol ($, €, ₹, £, etc.)

The pricing is automatically calculated based on the number of selected seats multiplied by the price per seat configured in the config file.

🎨 Customization

Override Methods

The SelectSeats class is designed to be easily extensible:

  • mount() - Load data and initialize booked seats
  • toggleSeat() - Add validation (e.g., prevent booking already booked seats)
  • proceed() - Add validation before booking
  • handleBooking() - Implement booking logic (save to database, notifications, etc.)

Customize Views

To customize the appearance and layout of the seat selection interface, you can publish the views:

php artisan vendor:publish --tag=cine-reserve-views

This will copy all view files to resources/views/vendor/cine-reserve/ where you can modify them:

  • select-seats.blade.php - Main seat selection page layout
  • components/movie-information.blade.php - Movie information display component
  • pricing-display.blade.php - Pricing information display
  • proceed-button.blade.php - Proceed to booking button
  • screen.blade.php - Screen indicator component

After publishing, edit these files in resources/views/vendor/cine-reserve/ to match your design requirements. The package will automatically use your customized views instead of the default ones.

Publish Translations

php artisan vendor:publish --tag=cine-reserve-translations

🎯 Events

seatSelected

Emitted when user clicks "Proceed to Booking":

[
    'selectedSeats' => [1, 2, 3],  // Array of seat IDs
    'seatDetails' => [              // Full seat information
        ['id' => 1, 'row' => 'A', 'number' => '1', 'label' => 'A1'],
    ],
    'count' => 3,                   // Number of selected seats
    'total' => 30.00                // Total price (calculated)
]

📝 Available Movie Properties

Set these properties in your SelectSeats component:

  • $moviePosterUrl - URL or path to movie poster
  • $movieTitle - Movie title
  • $movieGenre - Movie genre (string, array of strings, or array of enum objects)
  • $movieDuration - Movie duration
  • $movieRating - Movie rating
  • $movieDate - Show date
  • $movieStartTime - Show start time
  • $movieEndTime - Show end time
  • $movieTheater - Theater name
  • $moviePosterAlt - Alt text for poster

Sample Values

When no movie information is provided, the component automatically displays sample/demo values so you can see how it looks:

  • Title: "Sample Movie Title"
  • Genre: "Action"
  • Duration: "120 min"
  • Rating: "PG-13"
  • Date: Current date (formatted)
  • Start Time: "7:00 PM"
  • End Time: "9:30 PM"
  • Theater: "Theater 1"

This helps you visualize the component structure before implementing your own data. Once you set the movie properties, the actual data will replace the sample values.

⚠️ Important: File Storage Configuration

Movie poster images must be stored on the public disk for proper display.

Configuring Filament FileUpload

When using Filament's FileUpload component for movie posters, ensure you configure it to use the public disk:

use Filament\Forms\Components\FileUpload;

FileUpload::make('poster_url')
    ->image()
    ->disk('public')           // Required: Use public disk
    ->visibility('public')      // Required: Set visibility to public
    ->required(),

Why is this required? The movie information component displays images directly in the browser. Files stored on private disks cannot be accessed via direct URLs and will not display correctly. Using the public disk ensures that poster images are accessible and display properly.

🎨 Color Options

Available seat colors: amber, gray, red, green, purple, yellow

📄 License

MIT License - see LICENSE file for details

👤 Author

prazwal-bns

Built with ❤️ By Prajwal

przwl/cine-reserve 适用场景与选型建议

przwl/cine-reserve 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 36 次下载、GitHub Stars 达 16, 最近一次更新时间为 2025 年 12 月 21 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「booking」 「cinema」 「livewire」 「filament」 「seat-selection」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 przwl/cine-reserve 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 przwl/cine-reserve 我们能提供哪些服务?
定制开发 / 二次开发

基于 przwl/cine-reserve 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 36
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 16
  • 点击次数: 30
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 16
  • Watchers: 0
  • Forks: 1
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-21