### Install filament-help-desk with Composer Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/resources/boost/skills/filament-help-desk-development/SKILL.md Installs the filament-help-desk package version 1.x via Composer. ```bash composer require jeffersongoncalves/filament-help-desk:^1.0 ``` -------------------------------- ### Custom resource extending default TicketResource Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/README.md Example of a custom resource class that extends the default TicketResource and uses the getTicketFormSchema method to add custom fields. ```php namespace App\Filament\User\Resources; use JeffersonGoncalves\FilamentHelpDesk\User\Resources\TicketResource as BaseResource; class CustomTicketResource extends BaseResource { public static function form(Form $form): Form { return $form->schema([ ...static::getTicketFormSchema(isUser: true), // Add your custom fields ]); } } ``` -------------------------------- ### Override resource class in config/filament-help-desk.php Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/resources/boost/guidelines/filament-help-desk/1.x/introduction.md Override the default resource class in the config file config/filament-help-desk.php. This example replaces the user resource with a custom ticket resource class. ```php 'user' => [ 'resource' => \App\Filament\User\Resources\CustomTicketResource::class, ], ``` -------------------------------- ### Publish and run help-desk migrations Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/resources/boost/skills/filament-help-desk-development/SKILL.md Publishes and runs the package's migrations. ```bash php artisan vendor:publish --tag="help-desk-migrations" php artisan migrate ``` -------------------------------- ### Publish filament-help-desk config Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/resources/boost/skills/filament-help-desk-development/SKILL.md Publishes the package configuration file. ```bash php artisan vendor:publish --tag="filament-help-desk-config" ``` -------------------------------- ### Create a ticket programmatically with HelpDesk facade Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/resources/boost/skills/filament-help-desk-development/SKILL.md Creates a ticket programmatically using the HelpDesk facade. The second argument is the user who creates the ticket. ```php use JeffersonGoncalves\HelpDesk\Facades\HelpDesk; $ticket = HelpDesk::create([ 'title' => 'Issue with login', 'description' => 'Cannot access my account', 'department_id' => 1, 'priority' => 'high', ], $user); ``` -------------------------------- ### Create ticket with attachments and add reply Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/resources/boost/skills/filament-help-desk-development/SKILL.md Creates a ticket with attachments and adds a reply with attachments using the HelpDesk facade. ```php use JeffersonGoncalves\HelpDesk\Facades\HelpDesk; $ticket = HelpDesk::create([ 'title' => 'Bug report', 'description' => 'Steps to reproduce...', 'department_id' => $departmentId, 'category_id' => $categoryId, 'priority' => 'urgent', ], auth()->user()); // Add a comment HelpDesk::comments()->addReply($ticket, auth()->user(), 'Additional details...', [ 'attachments' => $request->file('files'), ]); ``` -------------------------------- ### Publish views with filament-help-desk-views tag Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/resources/boost/guidelines/filament-help-desk/1.x/introduction.md Publish the package views to customize them. Run this artisan command with the specified tag. ```bash php artisan vendor:publish --tag="filament-help-desk-views" ``` -------------------------------- ### Default configuration file config/filament-help-desk.php Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/README.md Shows the default configuration structure with user, operator, and admin panel settings, including resource classes, widgets, navigation options, and slugs. ```php return [ 'user' => [ 'resource' => \JeffersonGoncalves\FilamentHelpDesk\User\Resources\TicketResource::class, 'widgets' => [ \JeffersonGoncalves\FilamentHelpDesk\User\Widgets\UserTicketStatsWidget::class, ], 'navigation_group' => 'Support', 'navigation_icon' => 'heroicon-o-ticket', 'navigation_sort' => null, 'slug' => 'tickets', ], 'operator' => [ 'resource' => \JeffersonGoncalves\FilamentHelpDesk\Operator\Resources\TicketResource::class, 'widgets' => [ \JeffersonGoncalves\FilamentHelpDesk\Operator\Widgets\TicketsByStatusWidget::class, \JeffersonGoncalves\FilamentHelpDesk\Operator\Widgets\AssignedTicketsWidget::class, ], 'navigation_group' => 'Help Desk', 'navigation_icon' => 'heroicon-o-inbox-stack', 'slug' => 'tickets', ], 'admin' => [ 'navigation_group' => 'Help Desk', 'navigation_icon' => 'heroicon-o-cog-6-tooth', 'resources' => [ 'ticket' => \JeffersonGoncalves\FilamentHelpDesk\Admin\Resources\TicketResource::class, 'department' => \JeffersonGoncalves\FilamentHelpDesk\Admin\Resources\DepartmentResource::class, 'category' => \JeffersonGoncalves\FilamentHelpDesk\Admin\Resources\CategoryResource::class, 'canned_response' => \JeffersonGoncalves\FilamentHelpDesk\Admin\Resources\CannedResponseResource::class, 'email_channel' => \JeffersonGoncalves\FilamentHelpDesk\Admin\Resources\EmailChannelResource::class, ], 'widgets' => [ \JeffersonGoncalves\FilamentHelpDesk\Admin\Widgets\TicketsByPriorityWidget::class, \JeffersonGoncalves\FilamentHelpDesk\Admin\Widgets\TicketStatsOverviewWidget::class, ], ], ]; ``` -------------------------------- ### Format code with composer format Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/README.md Runs Pint code style fixer to format the code according to the project's style guidelines. ```bash composer format ``` -------------------------------- ### Run tests with composer test Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/README.md Runs the test suite for the package. Use this command to execute all tests. ```bash composer test ``` -------------------------------- ### Customize admin widgets in config Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/README.md Shows how to reorder, remove, or add widgets for the admin panel via the 'widgets' config key. ```php 'admin' => [ 'widgets' => [ \JeffersonGoncalves\FilamentHelpDesk\Admin\Widgets\TicketStatsOverviewWidget::class, // Remove TicketsByPriorityWidget by not including it \App\Filament\Widgets\CustomDashboardWidget::class, // Add your own ], ], ``` -------------------------------- ### Publish translations with filament-help-desk-translations tag Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/resources/boost/guidelines/filament-help-desk/1.x/introduction.md Publish the package translation files. Use this artisan command with the translations tag. ```bash php artisan vendor:publish --tag="filament-help-desk-translations" ``` -------------------------------- ### Register help-desk plugins in Filament panels Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/resources/boost/skills/filament-help-desk-development/SKILL.md Registers the user plugin in the UserPanelProvider and the admin and operator plugins in the AdminPanelProvider. The admin and operator plugins can be combined. ```php // In your UserPanelProvider ->plugins([ FilamentHelpDeskUserPlugin::make(), ]) // In your AdminPanelProvider ->plugins([ FilamentHelpDeskAdminPlugin::make(), FilamentHelpDeskOperatorPlugin::make(), // Can combine admin + operator ]) ``` -------------------------------- ### Run PHPStan analysis with composer analyse Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/README.md Runs PHPStan static analysis on the codebase. Use this command to check for type errors and potential bugs. ```bash composer analyse ``` -------------------------------- ### Disable all widgets for a panel Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/README.md Shows how to disable all widgets for a panel by setting the 'widgets' key to an empty array. ```php 'user' => [ 'widgets' => [], ], ``` -------------------------------- ### Disable entire User or Operator panel resource Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/README.md Shows how to disable the entire User or Operator panel resource by setting the 'resource' key to null. ```php 'user' => [ 'resource' => null, // Disables the user ticket resource // ... ], 'operator' => [ 'resource' => null, // Disables the operator ticket resource // ... ], ``` -------------------------------- ### Register FilamentHelpDeskUserPlugin in Panel Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/README.md Registers the User Plugin in a Filament panel. Provides ticket creation, listing, detail view, and stats widget for end-users. ```php use JeffersonGoncalves\FilamentHelpDesk\FilamentHelpDeskUserPlugin; class UserPanelProvider extends PanelProvider { public function panel(Panel $panel): Panel { return $panel // ... ->plugins([ FilamentHelpDeskUserPlugin::make(), ]); } } ``` -------------------------------- ### Register FilamentHelpDeskAdminPlugin in Panel Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/README.md Registers the Admin Plugin in a Filament panel. Provides CRUD for departments, categories, canned responses, email channel configuration, and full ticket management. ```php use JeffersonGoncalves\FilamentHelpDesk\FilamentHelpDeskAdminPlugin; class AdminPanelProvider extends PanelProvider { public function panel(Panel $panel): Panel { return $panel // ... ->plugins([ FilamentHelpDeskAdminPlugin::make(), ]); } } ``` -------------------------------- ### Register FilamentHelpDeskOperatorPlugin in Panel Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/README.md Registers the Operator Plugin in a Filament panel. Provides ticket queue, management, internal notes, canned responses, and widgets for support agents. ```php use JeffersonGoncalves\FilamentHelpDesk\FilamentHelpDeskOperatorPlugin; class OperatorPanelProvider extends PanelProvider { public function panel(Panel $panel): Panel { return $panel // ... ->plugins([ FilamentHelpDeskOperatorPlugin::make(), ]); } } ``` -------------------------------- ### Update config to use custom TicketResource Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/resources/boost/skills/filament-help-desk-development/SKILL.md Updates the config to use the custom TicketResource class for the user panel. ```php 'user' => [ 'resource' => \App\Filament\User\Resources\TicketResource::class, ], ``` -------------------------------- ### Disable email channel resource in admin panel Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/README.md Shows how to disable a resource by commenting out its key in the config file, which hides the navigation item. ```php 'admin' => [ 'resources' => [ 'ticket' => \JeffersonGoncalves\FilamentHelpDesk\Admin\Resources\TicketResource::class, 'department' => \JeffersonGoncalves\FilamentHelpDesk\Admin\Resources\DepartmentResource::class, 'category' => \JeffersonGoncalves\FilamentHelpDesk\Admin\Resources\CategoryResource::class, 'canned_response' => \JeffersonGoncalves\FilamentHelpDesk\Admin\Resources\CannedResponseResource::class, // 'email_channel' => \JeffersonGoncalves\FilamentHelpDesk\Admin\Resources\EmailChannelResource::class, ], ], ``` -------------------------------- ### Add HasTickets and IsOperator traits to User model Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/resources/boost/skills/filament-help-desk-development/SKILL.md Adds the HasTickets and IsOperator traits to the User model. The IsOperator trait is only for operator/admin users. ```php use JeffersonGoncalves\HelpDesk\Concerns\HasTickets; use JeffersonGoncalves\HelpDesk\Concerns\IsOperator; class User extends Authenticatable { use HasTickets; use IsOperator; // Only for operator/admin users } ``` -------------------------------- ### Assign a ticket to an operator Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/resources/boost/skills/filament-help-desk-development/SKILL.md Assigns a ticket to an operator. The third argument is the user performing the assignment. ```php HelpDesk::assign($ticket, $operator, auth()->user()); ``` -------------------------------- ### Change ticket status with TicketStatus enum Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/resources/boost/skills/filament-help-desk-development/SKILL.md Changes the status of a ticket using the TicketStatus enum. The third argument is the user performing the change. ```php use JeffersonGoncalves\HelpDesk\Enums\TicketStatus; HelpDesk::changeStatus($ticket, TicketStatus::InProgress, auth()->user()); ``` -------------------------------- ### Override TicketResource form schema Source: https://github.com/jeffersongoncalves/filament-help-desk/blob/3.x/resources/boost/skills/filament-help-desk-development/SKILL.md Overrides the form schema by extending the base TicketResource and using the shared ticket form schema as a base, then adding custom fields. ```php namespace App\Filament\User\Resources; use JeffersonGoncalves\FilamentHelpDesk\User\Resources\TicketResource as BaseResource; class TicketResource extends BaseResource { public static function form(Form $form): Form { return $form->schema([ // Your custom form schema ...static::getTicketFormSchema(isUser: true), // Add custom fields Forms\Components\Select::make('custom_field') ->options([...]), ]); } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.