new helpdesk module
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
# Helpdesk Module Install
|
||||
|
||||
## 1. Copy the module
|
||||
|
||||
Copy `Modules/Helpdesk` into your Laravel 13 project.
|
||||
|
||||
## 2. Register the provider
|
||||
|
||||
If your module loader reads `module.json`, no manual provider entry is needed. Otherwise add this provider to `bootstrap/providers.php`:
|
||||
|
||||
```php
|
||||
Modules\Helpdesk\Providers\HelpdeskServiceProvider::class,
|
||||
```
|
||||
|
||||
## 3. Add the helpdesk disk
|
||||
|
||||
Add this to `config/filesystems.php` disks:
|
||||
|
||||
```php
|
||||
'helpdesk' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/public/helpdesk'),
|
||||
'url' => env('APP_URL') . '/storage/helpdesk',
|
||||
'visibility' => 'public',
|
||||
],
|
||||
```
|
||||
|
||||
Then run:
|
||||
|
||||
```bash
|
||||
php artisan storage:link
|
||||
```
|
||||
|
||||
## 4. Add relations to `App\Models\User`
|
||||
|
||||
```php
|
||||
use Modules\Helpdesk\Concerns\HasHelpdeskTickets;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasHelpdeskTickets;
|
||||
}
|
||||
```
|
||||
|
||||
Add casts if you want strict booleans:
|
||||
|
||||
```php
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'email_verified_at' => 'datetime',
|
||||
'password' => 'hashed',
|
||||
'helpdesk_agent' => 'boolean',
|
||||
'helpdesk_admin' => 'boolean',
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
## 5. Run migrations and seeders
|
||||
|
||||
```bash
|
||||
php artisan migrate
|
||||
php artisan db:seed --class="Modules\\Helpdesk\\database\\seeders\\HelpdeskDatabaseSeeder"
|
||||
```
|
||||
|
||||
## 6. Add dashboard widget
|
||||
|
||||
Place this where you want it on your dashboard:
|
||||
|
||||
```blade
|
||||
@include('helpdesk::dashboard.card')
|
||||
```
|
||||
|
||||
or directly:
|
||||
|
||||
```blade
|
||||
<livewire:helpdesk.dashboard-widget />
|
||||
```
|
||||
|
||||
## 7. Navigation link
|
||||
|
||||
```blade
|
||||
<flux:navlist.item icon="lifebuoy" :href="route('helpdesk.tickets.index')" :current="request()->routeIs('helpdesk.*')" wire:navigate>
|
||||
Helpdesk
|
||||
</flux:navlist.item>
|
||||
```
|
||||
|
||||
## 8. Tests
|
||||
|
||||
```bash
|
||||
php artisan test Modules/Helpdesk/tests/Feature
|
||||
php artisan dusk Modules/Helpdesk/tests/Browser
|
||||
```
|
||||
Reference in New Issue
Block a user