new helpdesk module
This commit is contained in:
+24
-2
@@ -31,22 +31,43 @@ return new class extends Migration {
|
||||
|
||||
Schema::create('helpdesk_categories', static function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('company_id')->nullable()->constrained('companies')->nullOnDelete();
|
||||
$table->string('name', 120);
|
||||
$table->string('slug', 140)->unique();
|
||||
$table->string('slug', 140);
|
||||
$table->string('color', 30)->default('blue');
|
||||
$table->text('description')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['company_id', 'slug']);
|
||||
});
|
||||
|
||||
Schema::create('helpdesk_teams', static function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('company_id')->nullable()->constrained('companies')->nullOnDelete();
|
||||
$table->string('name', 120);
|
||||
$table->string('slug', 140);
|
||||
$table->string('color', 30)->default('indigo');
|
||||
$table->text('description')->nullable();
|
||||
$table->timestamp('archived_at')->nullable();
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['company_id', 'slug']);
|
||||
});
|
||||
|
||||
Schema::create('helpdesk_projects', static function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('company_id')->nullable()->constrained('companies')->nullOnDelete();
|
||||
$table->foreignId('team_id')->nullable()->constrained('helpdesk_teams')->nullOnDelete();
|
||||
$table->string('title', 160);
|
||||
$table->string('slug', 180)->unique();
|
||||
$table->string('slug', 180);
|
||||
$table->string('color', 30)->default('blue');
|
||||
$table->text('description')->nullable();
|
||||
$table->timestamp('archived_at')->nullable();
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['company_id', 'slug']);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -54,6 +75,7 @@ return new class extends Migration {
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('helpdesk_projects');
|
||||
Schema::dropIfExists('helpdesk_teams');
|
||||
Schema::dropIfExists('helpdesk_categories');
|
||||
Schema::dropIfExists('helpdesk_priorities');
|
||||
Schema::dropIfExists('helpdesk_statuses');
|
||||
|
||||
+4
@@ -13,12 +13,14 @@ return new class extends Migration {
|
||||
Schema::create('helpdesk_tickets', static function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->string('reference', 32)->unique();
|
||||
$table->foreignId('company_id')->nullable()->constrained('companies')->nullOnDelete();
|
||||
$table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
|
||||
$table->foreignId('agent_id')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->foreignId('status_id')->constrained('helpdesk_statuses')->restrictOnDelete();
|
||||
$table->foreignId('priority_id')->constrained('helpdesk_priorities')->restrictOnDelete();
|
||||
$table->foreignId('category_id')->nullable()->constrained('helpdesk_categories')->nullOnDelete();
|
||||
$table->foreignId('project_id')->nullable()->constrained('helpdesk_projects')->nullOnDelete();
|
||||
$table->foreignId('team_id')->nullable()->constrained('helpdesk_teams')->nullOnDelete();
|
||||
$table->string('subject', 200);
|
||||
$table->longText('body');
|
||||
$table->timestamp('due_at')->nullable();
|
||||
@@ -28,6 +30,8 @@ return new class extends Migration {
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['company_id', 'project_id']);
|
||||
$table->index(['team_id', 'status_id']);
|
||||
$table->index(['status_id', 'priority_id']);
|
||||
$table->index(['agent_id', 'completed_at']);
|
||||
$table->index(['user_id', 'created_at']);
|
||||
|
||||
@@ -10,6 +10,7 @@ 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;
|
||||
|
||||
final class HelpdeskDatabaseSeeder extends Seeder
|
||||
{
|
||||
@@ -38,7 +39,14 @@ final class HelpdeskDatabaseSeeder extends Seeder
|
||||
Category::query()->updateOrCreate(['slug' => Str::slug($name)], ['name' => $name, 'color' => 'blue']);
|
||||
}
|
||||
|
||||
$team = Team::query()->updateOrCreate(['slug' => 'support'], [
|
||||
'name' => 'Support',
|
||||
'color' => 'indigo',
|
||||
'description' => 'Default support team for helpdesk tickets.',
|
||||
]);
|
||||
|
||||
Project::query()->updateOrCreate(['slug' => 'internal-helpdesk'], [
|
||||
'team_id' => $team->id,
|
||||
'title' => 'Internal Helpdesk',
|
||||
'color' => 'blue',
|
||||
'description' => 'Default project for internal helpdesk tickets.',
|
||||
|
||||
Reference in New Issue
Block a user