---
name: zeus-thunder
description: Use when installing, configuring, or customizing lara-zeus/thunder help desk offices, tickets, permissions, replies, and Bolt form integration.
---

# Lara Zeus Thunder (`lara-zeus/thunder`)

## Overview & Requirements
`lara-zeus/thunder` is a paid Filament ticketing and help desk system using `lara-zeus/bolt` for per-office ticket forms and `lara-zeus/replies` for ticket discussions.
- **PHP**: `^8.2` (with `sqlite` PHP extension enabled per docs)
- **Dependencies**: `lara-zeus/bolt` (`^5.0`), `lara-zeus/replies` (`^3.0`), `lara-zeus/activity-timeline` (`^5.0`), `lara-zeus/inline-chart` (`^3.0`), `lara-zeus/quantity` (`^3.0`)

## Installation
Configure the Lara Zeus private Satis repository and license credentials in `auth.json` (from your `https://larazeus.com/dashboard` account):
```bash
composer config repositories.larazeus composer https://larazeus.com/satis
composer require lara-zeus/thunder
php artisan thunder:install
```
`php artisan thunder:install` publishes Bolt, Thunder, and Replies migrations and configs plus `zeus-config` and `zeus-assets`, then optionally runs `php artisan migrate`. Use `php artisan thunder:publish --force` to republish views/assets/seeders/factories.

## Configuration & Migrations
Published migrations: `create_offices_table`, `create_office_user_table`, `create_tickets_table`, `create_operations_table`.
Key options in `config/zeus-thunder.php`:
- `domain` (`null`), `prefix` (`'thunder'`), `table-prefix` (`'thunder_'`), `middleware` (`['web']`)
- `models`: `Office`, `Operations`, `Ticket`
- `enums`: `TicketsStatus`, `Abilities`
- `default-status` (`'OPEN'`), `ticket-no` (`TicketNo::class`), `office-mini-chart` (`OfficeTicketsChart::class`)

Also update `config/comments.php`:
```php
'comment_class' => \LaraZeus\Replies\Models\Comment::class,
```

## Filament Panel Registration
```php
use LaraZeus\Bolt\BoltPlugin;
use LaraZeus\SpatieTranslatable\SpatieTranslatablePlugin;
use LaraZeus\Thunder\Extensions\Thunder;
use LaraZeus\Thunder\ThunderPlugin;

->plugins([
    SpatieTranslatablePlugin::make()->defaultLocales([config('app.locale')]),
    BoltPlugin::make()
        ->extensions([
            Thunder::class,
        ]),
    ThunderPlugin::make()
        ->models([
            'Office' => \LaraZeus\Thunder\Models\Office::class,
            'Operations' => \LaraZeus\Thunder\Models\Operations::class,
            'Ticket' => \LaraZeus\Thunder\Models\Ticket::class,
        ])
        ->uploadDisk('public')
        ->uploadDirectory('tickets')
        ->navigationGroupLabel('Thunder'),
])
```

## Core Usage & Examples

### 1. User Model Trait & Authorization Gates
`ThunderServiceProvider::gates()` registers gates for all `LaraZeus\Thunder\Enums\Abilities` cases (`all`, `change_status`, `change_priority`, `manage_escalated`, `reply`, `transfer_ticket`, `delete_ticket`). Add `ManageOffice` to `User`:
```php
use LaraZeus\Thunder\Concerns\ManageOffice;

class User extends Authenticatable
{
    use ManageOffice;

    public function isSuperAdmin(): bool
    {
        return $this->email === 'info@larazeus.com';
    }
}
```

### 2. Frontend Routes, Embedding & Events
- **Routes** (`routes/web.php` under `zeus-thunder.prefix`, default `/thunder`):
  - `thunder.offices.list` (`/`), `thunder.office.show` (`/{office:slug}`)
  - `thunder.tickets.list` (`/tickets`, `auth`), `thunder.ticket.show` (`/ticket/{ticketNo}`, `auth`)
- **Embed an office ticket form**: `<livewire:bolt.fill-form slug="feedback" extensionSlug="printers-department" inline="true" />`
- **Custom ticket numbers**: Create a class with `public static function get(): string` and set `'ticket-no'` in `config/zeus-thunder.php`.
- **Event**: Listen to `LaraZeus\Thunder\Events\TicketCreated` (`$event->ticket`).

## Common Pitfalls
- **Missing `ManageOffice` trait**: Without `ManageOffice` on `App\Models\User`, `Gate` checks in `ThunderServiceProvider::gates()` fail on `isSuperAdmin()` and `offices()`.
- **Missing Bolt extension**: Omitting `Thunder::class` from `BoltPlugin::make()->extensions([...])` prevents linking Bolt forms to offices.
- **Comments misconfiguration**: Failing to set `'comment_class' => \LaraZeus\Replies\Models\Comment::class` in `config/comments.php` breaks ticket reply handling.
