started to add indexes and fixed N+1 issue
This commit is contained in:
@@ -8,6 +8,6 @@ return [
|
||||
'disk' => env('HELPDESK_ATTACHMENTS_DISK', 'helpdesk'),
|
||||
'max_upload_kb' => (int) env('HELPDESK_MAX_UPLOAD_KB', 10240),
|
||||
'allowed_mimes' => ['md','pdf', 'png', 'jpg', 'jpeg', 'webp', 'doc', 'docx', 'xls', 'xlsx', 'txt', 'csv', 'zip'],
|
||||
'default_status_slug' => 'open',
|
||||
'default_status_slug' => 'new',
|
||||
'closed_status_slug' => 'closed',
|
||||
];
|
||||
|
||||
+119
-44
@@ -1,56 +1,131 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
declare(strict_types=1);
|
||||
|
||||
class HelpdeskPerformanceIndexes extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/** @return void */
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('helpdesk_tickets', function (Blueprint $table): void {
|
||||
$table->index(['company_id', 'status_id']);
|
||||
$table->index(['company_id', 'priority_id']);
|
||||
$table->index(['company_id', 'category_id']);
|
||||
$table->index(['company_id', 'project_id']);
|
||||
$table->index(['company_id', 'team_id']);
|
||||
$table->index(['agent_id', 'completed_at']);
|
||||
$table->index(['user_id', 'created_at']);
|
||||
$table->index(['status_id', 'created_at']);
|
||||
$table->index(['last_activity_at']);
|
||||
$table->index(['due_at']);
|
||||
$table->index(['reference']);
|
||||
});
|
||||
$this->addIndex('helpdesk_tickets', ['company_id', 'status_id'], 'hdesk_tickets_company_status_idx');
|
||||
$this->addIndex('helpdesk_tickets', ['company_id', 'priority_id'], 'hdesk_tickets_company_priority_idx');
|
||||
$this->addIndex('helpdesk_tickets', ['company_id', 'category_id'], 'hdesk_tickets_company_category_idx');
|
||||
$this->addIndex('helpdesk_tickets', ['company_id', 'team_id'], 'hdesk_tickets_company_team_idx');
|
||||
$this->addIndex('helpdesk_tickets', ['status_id', 'created_at'], 'hdesk_tickets_status_created_idx');
|
||||
$this->addIndex('helpdesk_tickets', ['due_at'], 'hdesk_tickets_due_at_idx');
|
||||
$this->addIndex('helpdesk_tickets', ['archived_at'], 'hdesk_tickets_archived_at_idx');
|
||||
|
||||
Schema::table('helpdesk_comments', function (Blueprint $table): void {
|
||||
$table->index(['ticket_id', 'parent_id']);
|
||||
$table->index(['ticket_id', 'created_at']);
|
||||
$table->index(['parent_id', 'created_at']);
|
||||
$table->index(['user_id', 'created_at']);
|
||||
});
|
||||
$this->addIndex('helpdesk_comments', ['parent_id', 'created_at'], 'hdesk_comments_parent_created_idx');
|
||||
$this->addIndex('helpdesk_comments', ['user_id', 'created_at'], 'hdesk_comments_user_created_idx');
|
||||
|
||||
Schema::table('helpdesk_attachments', function (Blueprint $table): void {
|
||||
$table->index(['ticket_id']);
|
||||
$table->index(['comment_id']);
|
||||
$table->index(['user_id']);
|
||||
});
|
||||
$this->addIndex('helpdesk_attachments', ['ticket_id'], 'hdesk_attachments_ticket_idx');
|
||||
$this->addIndex('helpdesk_attachments', ['comment_id'], 'hdesk_attachments_comment_idx');
|
||||
$this->addIndex('helpdesk_attachments', ['user_id'], 'hdesk_attachments_user_idx');
|
||||
|
||||
Schema::table('helpdesk_projects', function (Blueprint $table): void {
|
||||
$table->index(['company_id', 'archived_at']);
|
||||
});
|
||||
if (Schema::hasTable('helpdesk_projects')) {
|
||||
$this->addIndex('helpdesk_projects', ['company_id', 'archived_at'], 'hdesk_projects_company_archived_idx');
|
||||
}
|
||||
|
||||
Schema::table('helpdesk_teams', function (Blueprint $table): void {
|
||||
$table->index(['company_id', 'archived_at']);
|
||||
});
|
||||
Schema::table('helpdesk_category_user', function (Blueprint $table): void {
|
||||
$table->index(['category_id', 'user_id']);
|
||||
$table->index(['user_id', 'category_id']);
|
||||
if (Schema::hasTable('helpdesk_teams')) {
|
||||
$this->addIndex('helpdesk_teams', ['company_id', 'archived_at'], 'hdesk_teams_company_archived_idx');
|
||||
}
|
||||
|
||||
if (Schema::hasTable('helpdesk_category_user')) {
|
||||
$this->addIndex('helpdesk_category_user', ['category_id', 'user_id'], 'hdesk_category_user_category_user_idx');
|
||||
$this->addIndex('helpdesk_category_user', ['user_id', 'category_id'], 'hdesk_category_user_user_category_idx');
|
||||
}
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function down(): void
|
||||
{
|
||||
foreach ([
|
||||
'helpdesk_tickets' => [
|
||||
'hdesk_tickets_company_status_idx',
|
||||
'hdesk_tickets_company_priority_idx',
|
||||
'hdesk_tickets_company_category_idx',
|
||||
'hdesk_tickets_company_team_idx',
|
||||
'hdesk_tickets_status_created_idx',
|
||||
'hdesk_tickets_due_at_idx',
|
||||
'hdesk_tickets_archived_at_idx',
|
||||
],
|
||||
'helpdesk_comments' => [
|
||||
'hdesk_comments_parent_created_idx',
|
||||
'hdesk_comments_user_created_idx',
|
||||
],
|
||||
'helpdesk_attachments' => [
|
||||
'hdesk_attachments_ticket_idx',
|
||||
'hdesk_attachments_comment_idx',
|
||||
'hdesk_attachments_user_idx',
|
||||
],
|
||||
'helpdesk_projects' => [
|
||||
'hdesk_projects_company_archived_idx',
|
||||
],
|
||||
'helpdesk_teams' => [
|
||||
'hdesk_teams_company_archived_idx',
|
||||
],
|
||||
'helpdesk_category_user' => [
|
||||
'hdesk_category_user_category_user_idx',
|
||||
'hdesk_category_user_user_category_idx',
|
||||
],
|
||||
] as $table => $indexes) {
|
||||
if (! Schema::hasTable($table)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Schema::table($table, function (Blueprint $tableBlueprint) use ($table, $indexes): void {
|
||||
foreach ($indexes as $index) {
|
||||
if ($this->indexExists($table, $index)) {
|
||||
$tableBlueprint->dropIndex($index);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an index only when the table exists and the named index does not exist.
|
||||
*
|
||||
* @param string $table
|
||||
* @param array<int, string> $columns
|
||||
* @param string $index
|
||||
* @return void
|
||||
*/
|
||||
private function addIndex(string $table, array $columns, string $index): void
|
||||
{
|
||||
if (! Schema::hasTable($table) || $this->indexExists($table, $index)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table($table, static function (Blueprint $tableBlueprint) use ($columns, $index): void {
|
||||
$tableBlueprint->index($columns, $index);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Determine whether an index exists for the current connection.
|
||||
*
|
||||
* @param string $table
|
||||
* @param string $index
|
||||
* @return bool
|
||||
*/
|
||||
private function indexExists(string $table, string $index): bool
|
||||
{
|
||||
if (method_exists(Schema::getFacadeRoot(), 'hasIndex')) {
|
||||
return Schema::hasIndex($table, $index);
|
||||
}
|
||||
|
||||
if (DB::getDriverName() === 'pgsql') {
|
||||
return DB::selectOne(
|
||||
'select 1 from pg_indexes where schemaname = current_schema() and tablename = ? and indexname = ? limit 1',
|
||||
[$table, $index]
|
||||
) !== null;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Helpdesk\Livewire;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Livewire\Attributes\Validate;
|
||||
use Livewire\Component;
|
||||
use Modules\Helpdesk\Models\Category;
|
||||
use Modules\Helpdesk\Models\Priority;
|
||||
use Modules\Helpdesk\Models\Project;
|
||||
use Modules\Helpdesk\Models\Status;
|
||||
use Modules\Helpdesk\Models\Team;
|
||||
use Modules\Helpdesk\Models\Ticket;
|
||||
use Modules\Helpdesk\Services\WorkflowNotificationService;
|
||||
|
||||
final class TicketEdit extends Component
|
||||
{
|
||||
public Ticket $ticket;
|
||||
|
||||
#[Validate('nullable|integer')]
|
||||
public ?int $company_id = null;
|
||||
|
||||
#[Validate('nullable|integer|exists:users,id')]
|
||||
public ?int $agent_id = null;
|
||||
|
||||
#[Validate('required|string|max:200')]
|
||||
public string $subject = '';
|
||||
|
||||
#[Validate('required|string|min:10')]
|
||||
public string $body = '';
|
||||
|
||||
#[Validate('required|integer|exists:helpdesk_statuses,id')]
|
||||
public ?int $status_id = null;
|
||||
|
||||
#[Validate('required|integer|exists:helpdesk_priorities,id')]
|
||||
public ?int $priority_id = null;
|
||||
|
||||
#[Validate('nullable|integer|exists:helpdesk_categories,id')]
|
||||
public ?int $category_id = null;
|
||||
|
||||
#[Validate('nullable|integer|exists:helpdesk_projects,id')]
|
||||
public ?int $project_id = null;
|
||||
|
||||
#[Validate('nullable|integer|exists:helpdesk_teams,id')]
|
||||
public ?int $team_id = null;
|
||||
|
||||
#[Validate('nullable|date')]
|
||||
public ?string $due_at = null;
|
||||
|
||||
/**
|
||||
* Populate editable ticket state.
|
||||
*/
|
||||
public function mount(Ticket $ticket): void
|
||||
{
|
||||
$this->authorize('update', $ticket);
|
||||
$this->ticket = $ticket->fresh(['status', 'priority', 'category', 'project', 'team', 'agent']) ?? $ticket;
|
||||
|
||||
$this->company_id = $this->ticket->company_id;
|
||||
$this->agent_id = $this->ticket->agent_id;
|
||||
$this->subject = $this->ticket->subject;
|
||||
$this->body = $this->ticket->body;
|
||||
$this->status_id = $this->ticket->status_id;
|
||||
$this->priority_id = $this->ticket->priority_id;
|
||||
$this->category_id = $this->ticket->category_id;
|
||||
$this->project_id = $this->ticket->project_id;
|
||||
$this->team_id = $this->ticket->team_id;
|
||||
$this->due_at = $this->ticket->due_at?->format('Y-m-d');
|
||||
}
|
||||
|
||||
/**
|
||||
* Save ticket changes.
|
||||
*/
|
||||
public function save(WorkflowNotificationService $workflow): mixed
|
||||
{
|
||||
$this->authorize('update', $this->ticket);
|
||||
$this->validate();
|
||||
|
||||
$status = Status::query()->findOrFail($this->status_id);
|
||||
|
||||
$this->ticket->forceFill([
|
||||
'company_id' => $this->company_id,
|
||||
'agent_id' => $this->agent_id,
|
||||
'subject' => $this->subject,
|
||||
'body' => $this->body,
|
||||
'status_id' => $status->id,
|
||||
'priority_id' => $this->priority_id,
|
||||
'category_id' => $this->category_id,
|
||||
'project_id' => $this->project_id,
|
||||
'team_id' => $this->team_id,
|
||||
'due_at' => $this->due_at ?: null,
|
||||
'completed_at' => $status->is_closed ? now() : null,
|
||||
'last_activity_at' => now(),
|
||||
])->save();
|
||||
|
||||
$this->ticket = $this->ticket->fresh(['owner', 'agent', 'status', 'priority', 'category', 'project', 'team']) ?? $this->ticket;
|
||||
$workflow->dispatch($this->ticket, $status->is_closed ? 'ticket.closed' : 'ticket.updated', Auth::user());
|
||||
|
||||
session()->flash('success', 'Ticket ' . $this->ticket->reference . ' has been updated.');
|
||||
|
||||
return redirect()->route('helpdesk.tickets.show', $this->ticket);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the ticket edit screen.
|
||||
*/
|
||||
public function render(): View
|
||||
{
|
||||
return view('helpdesk::livewire.ticket-edit', [
|
||||
'statuses' => Status::query()->orderBy('sort_order')->get(),
|
||||
'priorities' => Priority::query()->orderBy('sort_order')->get(),
|
||||
'categories' => Category::query()->orderBy('name')->get(),
|
||||
'companies' => Schema::hasTable('companies') ? DB::table('companies')->select(['id', 'name'])->orderBy('name')->get() : collect(),
|
||||
'teams' => Team::query()->whereNull('archived_at')->orderBy('name')->get(),
|
||||
'projects' => Project::query()->whereNull('archived_at')->orderBy('title')->get(),
|
||||
'agents' => User::query()
|
||||
->where(static function ($query): void {
|
||||
$query->where('helpdesk_agent', true)->orWhere('helpdesk_admin', true);
|
||||
})
|
||||
->orderBy('name')
|
||||
->get(['id', 'name', 'email']),
|
||||
])->layout('layouts.app');
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,16 @@
|
||||
<div class="mx-auto max-w-7xl space-y-6" dusk="helpdesk-kanban-board">
|
||||
<div class="mx-auto max-w-[1800px] space-y-6" dusk="helpdesk-kanban-board">
|
||||
<div class="overflow-hidden rounded-3xl border border-zinc-200 bg-white shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
|
||||
<div class="bg-gradient-to-br from-slate-950 via-slate-900 to-blue-950 px-6 py-7 text-white">
|
||||
<div class="flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between">
|
||||
<div>
|
||||
<p class="text-xs font-semibold uppercase tracking-[0.28em] text-blue-200">Helpdesk workflow</p>
|
||||
<h1 class="mt-2 text-3xl font-semibold tracking-tight">Kanban board</h1>
|
||||
<p class="mt-2 max-w-3xl text-sm text-blue-100/90">
|
||||
Move tickets through your configured statuses, keep priorities visible and trigger workflow notifications when work changes state.
|
||||
</p>
|
||||
<p class="mt-2 max-w-3xl text-sm text-blue-100/90">Drag tickets between configured statuses. Add, rename and order boards from Helpdesk Settings → Statuses.</p>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<flux:button :href="route('helpdesk.tickets.create')" wire:navigate variant="primary" icon="plus">
|
||||
New ticket
|
||||
</flux:button>
|
||||
|
||||
<flux:button :href="route('helpdesk.tickets.index')" wire:navigate variant="ghost" icon="list-bullet">
|
||||
List view
|
||||
</flux:button>
|
||||
<flux:button :href="route('helpdesk.tickets.create')" wire:navigate variant="primary" icon="plus">New ticket</flux:button>
|
||||
<flux:button :href="route('helpdesk.settings')" wire:navigate variant="ghost" icon="cog-6-tooth">Configure boards</flux:button>
|
||||
<flux:button :href="route('helpdesk.tickets.index')" wire:navigate variant="ghost" icon="list-bullet">List view</flux:button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -29,130 +22,120 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="grid gap-4 overflow-x-auto lg:grid-cols-{{ max(1, min(5, $statuses->count())) }}">
|
||||
<div
|
||||
class="flex gap-4 overflow-x-auto pb-4"
|
||||
x-data="{
|
||||
draggedTicketId: null,
|
||||
draggingOverStatusId: null,
|
||||
dragStart(event) {
|
||||
this.draggedTicketId = event.currentTarget.dataset.ticketId;
|
||||
event.dataTransfer.effectAllowed = 'move';
|
||||
event.dataTransfer.setData('text/plain', this.draggedTicketId);
|
||||
event.currentTarget.classList.add('opacity-60', 'rotate-1');
|
||||
},
|
||||
dragEnd(event) {
|
||||
event.currentTarget.classList.remove('opacity-60', 'rotate-1');
|
||||
this.draggedTicketId = null;
|
||||
this.draggingOverStatusId = null;
|
||||
},
|
||||
dragOver(event, statusId) {
|
||||
event.preventDefault();
|
||||
this.draggingOverStatusId = String(statusId);
|
||||
event.dataTransfer.dropEffect = 'move';
|
||||
},
|
||||
dragLeave(statusId) {
|
||||
if (this.draggingOverStatusId === String(statusId)) {
|
||||
this.draggingOverStatusId = null;
|
||||
}
|
||||
},
|
||||
drop(event, statusId) {
|
||||
event.preventDefault();
|
||||
const ticketId = event.dataTransfer.getData('text/plain') || this.draggedTicketId;
|
||||
this.draggingOverStatusId = null;
|
||||
|
||||
if (!ticketId) {
|
||||
return;
|
||||
}
|
||||
|
||||
$wire.moveTicket(parseInt(ticketId, 10), parseInt(statusId, 10));
|
||||
}
|
||||
}"
|
||||
>
|
||||
@foreach ($statuses as $status)
|
||||
@php($tickets = $ticketsByStatus[$status->id] ?? collect())
|
||||
|
||||
<section
|
||||
class="min-w-[280px] rounded-2xl border border-zinc-200 bg-zinc-50 shadow-sm dark:border-zinc-700 dark:bg-zinc-950"
|
||||
class="flex min-h-[640px] w-[340px] shrink-0 flex-col overflow-hidden rounded-2xl border border-zinc-200 bg-zinc-100 shadow-sm dark:border-zinc-700 dark:bg-zinc-950"
|
||||
x-bind:class="draggingOverStatusId === '{{ $status->id }}' ? 'ring-2 ring-blue-500 ring-offset-2 dark:ring-offset-zinc-950' : ''"
|
||||
x-on:dragover="dragOver($event, {{ $status->id }})"
|
||||
x-on:dragleave="dragLeave({{ $status->id }})"
|
||||
x-on:drop="drop($event, {{ $status->id }})"
|
||||
dusk="kanban-column-{{ $status->slug }}"
|
||||
>
|
||||
<header class="flex items-center justify-between border-b border-zinc-200 bg-white px-4 py-3 dark:border-zinc-800 dark:bg-zinc-900">
|
||||
<div>
|
||||
<h2 class="text-sm font-semibold text-zinc-900 dark:text-zinc-100">{{ $status->name }}</h2>
|
||||
<p class="text-xs text-zinc-500">{{ $tickets->count() }} tickets</p>
|
||||
<header class="border-b border-zinc-200 bg-white px-4 py-4 dark:border-zinc-800 dark:bg-zinc-900">
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div>
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="inline-flex h-3 w-3 rounded-full" style="background-color: {{ $status->color }}"></span>
|
||||
<h2 class="text-sm font-semibold text-zinc-900 dark:text-zinc-100">{{ $status->name }}</h2>
|
||||
</div>
|
||||
<p class="mt-1 text-xs text-zinc-500">{{ $tickets->count() }} tickets</p>
|
||||
</div>
|
||||
@if ($status->is_closed)
|
||||
<span class="rounded-full bg-emerald-100 px-2 py-1 text-xs font-semibold text-emerald-700 dark:bg-emerald-950 dark:text-emerald-200">Closed</span>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<span class="inline-flex h-3 w-3 rounded-full" style="background-color: {{ $status->color }}"></span>
|
||||
</header>
|
||||
|
||||
<div
|
||||
class="min-h-[180px] space-y-3 p-3"
|
||||
data-helpdesk-kanban-column
|
||||
data-status-id="{{ $status->id }}"
|
||||
>
|
||||
<div class="flex-1 space-y-3 overflow-y-auto p-3">
|
||||
@forelse ($tickets as $ticket)
|
||||
<article
|
||||
class="cursor-grab rounded-xl border border-zinc-200 bg-white p-4 shadow-sm active:cursor-grabbing dark:border-zinc-800 dark:bg-zinc-900"
|
||||
data-helpdesk-kanban-ticket
|
||||
wire:key="kanban-ticket-{{ $ticket->id }}"
|
||||
draggable="true"
|
||||
x-on:dragstart="dragStart($event)"
|
||||
x-on:dragend="dragEnd($event)"
|
||||
class="group cursor-grab rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm transition hover:-translate-y-0.5 hover:shadow-md active:cursor-grabbing dark:border-zinc-800 dark:bg-zinc-900"
|
||||
data-ticket-id="{{ $ticket->id }}"
|
||||
dusk="kanban-ticket-{{ $ticket->id }}"
|
||||
>
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div>
|
||||
<a
|
||||
href="{{ route('helpdesk.tickets.show', $ticket) }}"
|
||||
wire:navigate
|
||||
class="text-sm font-semibold text-blue-700 hover:underline dark:text-blue-300"
|
||||
>
|
||||
{{ $ticket->reference }}
|
||||
</a>
|
||||
|
||||
<h3 class="mt-1 line-clamp-2 text-sm font-medium text-zinc-900 dark:text-zinc-100">
|
||||
{{ $ticket->subject }}
|
||||
</h3>
|
||||
<div class="min-w-0">
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="font-mono text-xs font-semibold text-blue-700 dark:text-blue-300">{{ $ticket->reference }}</span>
|
||||
<span class="text-xs text-zinc-400">⋮⋮</span>
|
||||
</div>
|
||||
<h3 class="mt-2 line-clamp-3 text-sm font-semibold text-zinc-900 dark:text-zinc-100">{{ $ticket->subject }}</h3>
|
||||
</div>
|
||||
|
||||
@if ($ticket->priority)
|
||||
<span class="rounded-full px-2 py-1 text-xs font-semibold text-white" style="background-color: {{ $ticket->priority->color }}">
|
||||
{{ $ticket->priority->name }}
|
||||
</span>
|
||||
<span class="shrink-0 rounded-full px-2 py-1 text-xs font-semibold text-white" style="background-color: {{ $ticket->priority->color }}">{{ $ticket->priority->name }}</span>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3 space-y-1 text-xs text-zinc-500 dark:text-zinc-400">
|
||||
<div>Owner: {{ $ticket->owner?->name ?? 'Unknown' }}</div>
|
||||
|
||||
<div>Agent: {{ $ticket->agent?->name ?? 'Unassigned' }}</div>
|
||||
@if ($ticket->project)
|
||||
<div>Project: {{ $ticket->project->title }}</div>
|
||||
@endif
|
||||
|
||||
@if ($ticket->team)
|
||||
<div>Team: {{ $ticket->team->name }}</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-4 grid grid-cols-2 gap-2">
|
||||
@foreach ($statuses as $targetStatus)
|
||||
@continue($targetStatus->id === $status->id)
|
||||
|
||||
<button
|
||||
type="button"
|
||||
wire:click="moveTicket({{ $ticket->id }}, {{ $targetStatus->id }})"
|
||||
class="rounded-lg border border-zinc-200 px-2 py-1 text-xs font-medium text-zinc-700 hover:bg-zinc-100 dark:border-zinc-700 dark:text-zinc-200 dark:hover:bg-zinc-800"
|
||||
>
|
||||
{{ $targetStatus->name }}
|
||||
</button>
|
||||
@endforeach
|
||||
<div class="mt-4 flex items-center justify-between gap-2 border-t border-zinc-100 pt-3 dark:border-zinc-800">
|
||||
<a href="{{ route('helpdesk.tickets.show', $ticket) }}" wire:navigate class="rounded-lg bg-blue-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-blue-700">Open</a>
|
||||
@can('update', $ticket)
|
||||
<a href="{{ route('helpdesk.tickets.edit', $ticket) }}" wire:navigate class="rounded-lg bg-emerald-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-emerald-700">Edit</a>
|
||||
@endcan
|
||||
</div>
|
||||
</article>
|
||||
@empty
|
||||
<div class="rounded-xl border border-dashed border-zinc-300 bg-white p-6 text-center text-sm text-zinc-500 dark:border-zinc-700 dark:bg-zinc-900">
|
||||
No tickets in {{ $status->name }}.
|
||||
Drop tickets here to move them to {{ $status->name }}.
|
||||
</div>
|
||||
@endforelse
|
||||
</div>
|
||||
</section>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
@script
|
||||
<script>
|
||||
const initialiseHelpdeskKanban = function () {
|
||||
if (!window.Sortable) {
|
||||
return;
|
||||
}
|
||||
|
||||
document.querySelectorAll('[data-helpdesk-kanban-column]').forEach(function (column) {
|
||||
if (column.dataset.sortableReady === '1') {
|
||||
return;
|
||||
}
|
||||
|
||||
column.dataset.sortableReady = '1';
|
||||
|
||||
new window.Sortable(column, {
|
||||
group: 'helpdesk-kanban',
|
||||
animation: 150,
|
||||
draggable: '[data-helpdesk-kanban-ticket]',
|
||||
filter: 'a, button',
|
||||
preventOnFilter: false,
|
||||
onEnd: function (event) {
|
||||
const ticketId = event.item.dataset.ticketId;
|
||||
const statusId = event.to.dataset.statusId;
|
||||
|
||||
if (!ticketId || !statusId) {
|
||||
return;
|
||||
}
|
||||
|
||||
$wire.moveTicket(ticketId, statusId);
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
initialiseHelpdeskKanban();
|
||||
|
||||
document.addEventListener('livewire:navigated', initialiseHelpdeskKanban);
|
||||
</script>
|
||||
@endscript
|
||||
</div>
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
<div class="space-y-6">
|
||||
@include('helpdesk::partials.page-header', [
|
||||
'eyebrow' => 'Helpdesk',
|
||||
'title' => 'Create Ticket',
|
||||
'subtitle' => 'Raise a new support request with priority, project, category, team and full details.',
|
||||
])
|
||||
|
||||
<form method="POST" action="{{ route('helpdesk.tickets.store') }}" enctype="multipart/form-data" wire:submit.prevent="save" class="space-y-6">
|
||||
@csrf
|
||||
|
||||
<div class="rounded-2xl border border-zinc-200 bg-white shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
|
||||
<div class="border-b border-zinc-200 px-6 py-4 dark:border-zinc-700">
|
||||
<h2 class="text-lg font-semibold text-zinc-900 dark:text-zinc-100">Ticket details</h2>
|
||||
<p class="mt-1 text-sm text-zinc-500 dark:text-zinc-400">Capture the request clearly so the support workflow can route and notify correctly.</p>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-6 p-6 lg:grid-cols-2">
|
||||
<div class="lg:col-span-2">
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="subject">Subject</label>
|
||||
<input id="subject" name="subject" type="text" wire:model.defer="subject" value="{{ old('subject', $subject) }}" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100" data-dusk="ticket-subject">
|
||||
@error('subject') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
@if($companies->isNotEmpty())
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="company_id">Company</label>
|
||||
<select id="company_id" name="company_id" wire:model.defer="company_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
<option value="">Select company</option>
|
||||
@foreach ($companies as $company)
|
||||
<option value="{{ $company->id }}">{{ $company->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('company_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="priority_id">Priority</label>
|
||||
<select id="priority_id" name="priority_id" wire:model.defer="priority_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100" data-dusk="ticket-priority">
|
||||
<option value="">Select priority</option>
|
||||
@foreach ($priorities as $priority)
|
||||
<option value="{{ $priority->id }}">{{ $priority->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('priority_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="category_id">Category</label>
|
||||
<select id="category_id" name="category_id" wire:model.defer="category_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
<option value="">Select category</option>
|
||||
@foreach ($categories as $category)
|
||||
<option value="{{ $category->id }}">{{ $category->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('category_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="project_id">Project</label>
|
||||
<select id="project_id" name="project_id" wire:model.defer="project_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
<option value="">Select project</option>
|
||||
@foreach ($projects as $project)
|
||||
<option value="{{ $project->id }}">{{ $project->title ?? $project->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('project_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="team_id">Team</label>
|
||||
<select id="team_id" name="team_id" wire:model.defer="team_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
<option value="">Select team</option>
|
||||
@foreach ($teams as $team)
|
||||
<option value="{{ $team->id }}">{{ $team->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('team_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="due_at">Due date</label>
|
||||
<input id="due_at" name="due_at" type="date" wire:model.defer="due_at" value="{{ old('due_at', $due_at) }}" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
@error('due_at') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div class="lg:col-span-2">
|
||||
<x-helpdesk::html-editor dusk="ticket-body-editor" wire:model="body" label="Details" rows="10" placeholder="Describe the issue, expected outcome, steps to reproduce and any useful context..." />
|
||||
</div>
|
||||
|
||||
<div class="lg:col-span-2">
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="attachments">Attachments</label>
|
||||
<input id="attachments" name="attachments[]" type="file" wire:model="attachments" multiple class="mt-2 block w-full rounded-xl border border-zinc-300 bg-white px-3 py-2 text-sm shadow-sm dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
@error('attachments') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
@error('attachments.*') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end gap-3 border-t border-zinc-200 px-6 py-4 dark:border-zinc-700">
|
||||
<a href="{{ route('helpdesk.tickets.index') }}" class="rounded-xl border border-zinc-300 px-4 py-2 text-sm font-semibold text-zinc-700 hover:bg-zinc-50 dark:border-zinc-700 dark:text-zinc-200 dark:hover:bg-zinc-800">Cancel</a>
|
||||
<button type="submit" class="rounded-xl bg-blue-600 px-5 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-700" data-dusk="ticket-create-submit">Create Ticket</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -0,0 +1,116 @@
|
||||
<div class="space-y-6" dusk="helpdesk-ticket-edit">
|
||||
@include('helpdesk::partials.page-header', [
|
||||
'eyebrow' => 'Helpdesk',
|
||||
'title' => 'Edit Ticket',
|
||||
'subtitle' => 'Update assignment, workflow status, priority, project, team and ticket content.',
|
||||
])
|
||||
|
||||
<form wire:submit.prevent="save" class="space-y-6">
|
||||
<div class="rounded-2xl border border-zinc-200 bg-white shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
|
||||
<div class="border-b border-zinc-200 px-6 py-4 dark:border-zinc-700">
|
||||
<h2 class="text-lg font-semibold text-zinc-900 dark:text-zinc-100">Ticket information</h2>
|
||||
<p class="mt-1 text-sm text-zinc-500 dark:text-zinc-400">Changes are applied to the ticket and workflow notifications are triggered where configured.</p>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-6 p-6 lg:grid-cols-2">
|
||||
<div class="lg:col-span-2">
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="subject">Subject</label>
|
||||
<input id="subject" type="text" wire:model.defer="subject" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100" data-dusk="ticket-edit-subject">
|
||||
@error('subject') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
@if($companies->isNotEmpty())
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="company_id">Company</label>
|
||||
<select id="company_id" wire:model.defer="company_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
<option value="">No company</option>
|
||||
@foreach ($companies as $company)
|
||||
<option value="{{ $company->id }}">{{ $company->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('company_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="agent_id">Assigned agent</label>
|
||||
<select id="agent_id" wire:model.defer="agent_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100" data-dusk="ticket-edit-agent">
|
||||
<option value="">Unassigned</option>
|
||||
@foreach ($agents as $agent)
|
||||
<option value="{{ $agent->id }}">{{ $agent->name }}{{ $agent->email ? ' — '.$agent->email : '' }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('agent_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="status_id">Status</label>
|
||||
<select id="status_id" wire:model.defer="status_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100" data-dusk="ticket-edit-status">
|
||||
@foreach ($statuses as $status)
|
||||
<option value="{{ $status->id }}">{{ $status->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('status_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="priority_id">Priority</label>
|
||||
<select id="priority_id" wire:model.defer="priority_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
@foreach ($priorities as $priority)
|
||||
<option value="{{ $priority->id }}">{{ $priority->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('priority_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="category_id">Category</label>
|
||||
<select id="category_id" wire:model.defer="category_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
<option value="">No category</option>
|
||||
@foreach ($categories as $category)
|
||||
<option value="{{ $category->id }}">{{ $category->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('category_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="project_id">Project</label>
|
||||
<select id="project_id" wire:model.defer="project_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
<option value="">No project</option>
|
||||
@foreach ($projects as $project)
|
||||
<option value="{{ $project->id }}">{{ $project->title ?? $project->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('project_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="team_id">Team</label>
|
||||
<select id="team_id" wire:model.defer="team_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
<option value="">No team</option>
|
||||
@foreach ($teams as $team)
|
||||
<option value="{{ $team->id }}">{{ $team->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('team_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="due_at">Due date</label>
|
||||
<input id="due_at" type="date" wire:model.defer="due_at" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
@error('due_at') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div class="lg:col-span-2">
|
||||
<x-helpdesk::html-editor dusk="ticket-edit-body-editor" wire:model="body" label="Details" rows="10" placeholder="Describe the request, steps, expected outcome and current status..." />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end gap-3 border-t border-zinc-200 px-6 py-4 dark:border-zinc-700">
|
||||
<a href="{{ route('helpdesk.tickets.show', $ticket) }}" wire:navigate class="rounded-xl bg-blue-600 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-700">Back</a>
|
||||
<button type="submit" class="rounded-xl bg-emerald-600 px-5 py-2 text-sm font-semibold text-white shadow-sm hover:bg-emerald-700" data-dusk="ticket-edit-submit">Save Ticket</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -11,7 +11,12 @@
|
||||
<h1 class="text-3xl font-semibold tracking-tight">{{ $ticket->subject }}</h1>
|
||||
<p class="mt-2 text-sm text-blue-100/90">Raised by {{ $ticket->owner?->name ?? 'Unknown user' }} · Assigned to {{ $ticket->agent?->name ?? 'Unassigned' }}</p>
|
||||
</div>
|
||||
<flux:button :href="route('helpdesk.tickets.index')" wire:navigate icon="arrow-left" variant="ghost">Back</flux:button>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<a href="{{ route('helpdesk.tickets.index') }}" wire:navigate class="inline-flex items-center rounded-xl bg-blue-600 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-700">Back</a>
|
||||
@can('update', $ticket)
|
||||
<a href="{{ route('helpdesk.tickets.edit', $ticket) }}" wire:navigate class="inline-flex items-center rounded-xl bg-emerald-600 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-emerald-700">Edit</a>
|
||||
@endcan
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -102,12 +107,22 @@
|
||||
@can('update', $ticket)
|
||||
<div class="rounded-2xl border border-zinc-200 bg-white p-5 shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
|
||||
<h2 class="mb-4 text-base font-semibold text-zinc-900 dark:text-white">Agent actions</h2>
|
||||
<flux:select wire:model="agent_id" label="Assigned agent">
|
||||
<option value="">Unassigned</option>
|
||||
@foreach ($agents as $agent)
|
||||
<option value="{{ $agent->id }}">{{ $agent->name }}</option>
|
||||
@endforeach
|
||||
</flux:select>
|
||||
<flux:button dusk="update-agent" wire:click="updateAssignment" class="mt-4 w-full" variant="ghost" icon="user">Update assignment</flux:button>
|
||||
|
||||
<div class="mt-5">
|
||||
<flux:select wire:model="status_id" label="Status">
|
||||
@foreach ($statuses as $status)
|
||||
<option value="{{ $status->id }}">{{ $status->name }}</option>
|
||||
@endforeach
|
||||
</flux:select>
|
||||
<flux:button dusk="update-status" wire:click="updateStatus" class="mt-4 w-full" variant="primary" icon="check">Update status</flux:button>
|
||||
</div>
|
||||
<div class="mt-5">
|
||||
<flux:select wire:model="priority_id" label="Priority">
|
||||
@foreach ($priorities as $priority)
|
||||
|
||||
@@ -8,6 +8,7 @@ use Modules\Helpdesk\Http\Controllers\TicketStoreController;
|
||||
use Modules\Helpdesk\Livewire\KanbanBoard;
|
||||
use Modules\Helpdesk\Livewire\SettingsManager;
|
||||
use Modules\Helpdesk\Livewire\TicketCreate;
|
||||
use Modules\Helpdesk\Livewire\TicketEdit;
|
||||
use Modules\Helpdesk\Livewire\TicketIndex;
|
||||
use Modules\Helpdesk\Livewire\TicketShow;
|
||||
|
||||
@@ -19,4 +20,5 @@ Route::get('/kanban', KanbanBoard::class)->name('kanban');
|
||||
Route::get('/tickets', TicketIndex::class)->name('tickets.index');
|
||||
Route::post('/tickets', [TicketStoreController::class, 'store'])->name('tickets.store');
|
||||
Route::get('/tickets/create', TicketCreate::class)->name('tickets.create');
|
||||
Route::get('/tickets/{ticket}/edit', TicketEdit::class)->name('tickets.edit');
|
||||
Route::get('/tickets/{ticket}', TicketShow::class)->name('tickets.show');
|
||||
|
||||
@@ -30,16 +30,15 @@ final class TicketService
|
||||
{
|
||||
return DB::transaction(function () use ($user, $data, $files): Ticket {
|
||||
$status = Status::query()
|
||||
->where('slug', config('helpdesk.default_status_slug', 'open'))
|
||||
->where('slug', config('helpdesk.default_status_slug', 'new'))
|
||||
->first();
|
||||
|
||||
if (! $status) {
|
||||
$status = Status::query()->create([
|
||||
'name' => 'Open',
|
||||
'slug' => config('helpdesk.default_status_slug', 'open'),
|
||||
'colour' => '#2563eb',
|
||||
'sort_order' => 1,
|
||||
'is_default' => true,
|
||||
'name' => 'New',
|
||||
'slug' => config('helpdesk.default_status_slug', 'new'),
|
||||
'color' => 'sky',
|
||||
'sort_order' => 5,
|
||||
'is_closed' => false,
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user