migrate to gtea from bistbucket
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('support_ticket_f_a_q_s', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable();
|
||||
$table->string('question'); // Question field
|
||||
$table->text('answer'); // Answer field
|
||||
$table->smallInteger('status')->default(1)->comment('1=Active, 2=InActive');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('support_ticket_f_a_q_s');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('support_ticket_ip_infos', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable();
|
||||
$table->string('ip_address');
|
||||
$table->string('country')->nullable();
|
||||
$table->string('division')->nullable();
|
||||
$table->string('city')->nullable();
|
||||
$table->string('zip_code')->nullable();
|
||||
$table->decimal('latitude', 10, 7)->nullable(); // Latitude with precision
|
||||
$table->decimal('longitude', 10, 7)->nullable(); // Longitude with precision
|
||||
$table->string('device_type')->nullable(); // Mobile, Desktop, etc.
|
||||
$table->string('browser')->nullable();
|
||||
$table->string('operating_system')->nullable();
|
||||
$table->timestamp('login_at')->nullable(); // Login timestamp
|
||||
$table->smallInteger('status')->default(1)->comment('1=Active, 2=InActive');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('support_ticket_ip_infos');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('support_ticket_categories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable();
|
||||
$table->string('name');
|
||||
$table->text('description')->nullable();
|
||||
$table->smallInteger('status')->default(1)->comment('1=Active, 2=InActive');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('support_ticket_categories');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('support_tickets', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable();
|
||||
$table->string('readable_ticket_id')->nullable();
|
||||
$table->foreignId('user_id')->constrained('users')->onDelete('cascade');
|
||||
$table->foreignId('category_id')->nullable()->constrained('support_ticket_categories')->onDelete('cascade');
|
||||
$table->string('title');
|
||||
$table->text('description')->nullable();
|
||||
$table->string('purchase_code')->nullable();
|
||||
$table->boolean('read')->default(false);
|
||||
$table->string('related_url')->nullable();
|
||||
$table->string('support_plan')->nullable();
|
||||
$table->json('attachments')->nullable();
|
||||
$table->timestamp('last_conversation_time')->nullable();
|
||||
$table->timestamp('last_respond_by_client_at')->nullable();
|
||||
$table->enum('status', ['open', 'closed', 'pending', 'resolved'])->default('open');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('support_tickets');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('support_ticket_conversations', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable();
|
||||
$table->foreignId('ticket_id')->constrained('support_tickets')->onDelete('cascade');
|
||||
$table->foreignId('user_id')->nullable()->constrained('users')->onDelete('cascade')->after('ticket_id');
|
||||
$table->text('message');
|
||||
$table->json('attachments')->nullable();
|
||||
$table->enum('user_type', ['user', 'agent', 'admin']);
|
||||
$table->smallInteger('status')->default(1)->comment('1=Active, 2=InActive');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('support_ticket_conversations');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('support_ticket_last_conversations', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable();
|
||||
$table->foreignId('ticket_id')->constrained('support_tickets')->onDelete('cascade');
|
||||
$table->text('message');
|
||||
$table->enum('user_type', ['user', 'agent', 'admin']);
|
||||
$table->smallInteger('status')->default(1)->comment('1=Active, 2=InActive');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('support_ticket_last_conversations');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('support_ticket_licenses', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('restaurant_id')->nullable();
|
||||
$table->foreignId('ticket_id')->constrained('support_tickets')->onDelete('cascade');
|
||||
$table->string('license_code')->unique();
|
||||
$table->date('expires_date');
|
||||
$table->string('transaction_id')->nullable();
|
||||
$table->foreignId('user_id')->constrained('users')->onDelete('cascade');
|
||||
$table->smallInteger('status')->default(1)->comment('1=Active, 2=InActive');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('support_ticket_licenses');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\SupportTicket\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class SupportTicketCategoriesTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
DB::table('support_ticket_categories')->insert([
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'name' => 'Support',
|
||||
'description' => 'Support-related queries',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'name' => 'Tech',
|
||||
'description' => 'Technical assistance',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\SupportTicket\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class SupportTicketDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$this->call([
|
||||
SupportTicketFAQSeeder::class,
|
||||
SupportTicketCategoriesTableSeeder::class,
|
||||
TicketTableSeeder::class,
|
||||
TicketConversationsTableSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\SupportTicket\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Modules\SupportTicket\Models\SupportTicketFAQ;
|
||||
|
||||
class SupportTicketFAQSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$faqs = [
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'question' => 'What is the return policy?',
|
||||
'answer' => 'You can return the product within 30 days of purchase.',
|
||||
'created_at' => '2025-01-01T12:00:00Z',
|
||||
'updated_at' => '2025-01-05T14:30:00Z',
|
||||
],
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'question' => 'How can I track my order?',
|
||||
'answer' => 'You can track your order using the tracking link sent to your email after the order is shipped.',
|
||||
'created_at' => '2025-01-02T09:00:00Z',
|
||||
'updated_at' => '2025-01-06T10:00:00Z',
|
||||
],
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'question' => 'Is customer support available 24/7?',
|
||||
'answer' => 'Yes, our customer support is available 24/7 to assist you.',
|
||||
'created_at' => '2025-01-03T15:45:00Z',
|
||||
'updated_at' => '2025-01-07T16:00:00Z',
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($faqs as $faq) {
|
||||
SupportTicketFAQ::create($faq);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\SupportTicket\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class TicketConversationsTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
DB::table('support_ticket_conversations')->insert([
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'ticket_id' => 1,
|
||||
'message' => 'This is the last message in the conversation 1.',
|
||||
'user_type' => 'user', // Possible values: 'user', 'agent'
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'ticket_id' => 1,
|
||||
'message' => 'Follow-up message from the agent 1.',
|
||||
'user_type' => 'agent',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'ticket_id' => 1,
|
||||
'message' => 'This is the last message in the conversation 2.',
|
||||
'user_type' => 'user', // Possible values: 'user', 'agent'
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'ticket_id' => 1,
|
||||
'message' => 'Follow-up message from the agent 2.',
|
||||
'user_type' => 'agent',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
|
||||
// 2
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'ticket_id' => 2,
|
||||
'message' => 'This is the last message in the conversation.',
|
||||
'user_type' => 'user', // Possible values: 'user', 'agent'
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'ticket_id' => 2,
|
||||
'message' => 'Follow-up message from the agent.',
|
||||
'user_type' => 'agent',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\SupportTicket\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class TicketTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
DB::table('support_tickets')->insert([
|
||||
[
|
||||
'readable_ticket_id' => Str::random(6),
|
||||
'user_id' => 1, // Assuming user_id 1 exists
|
||||
'category_id' => 1, // Assuming category_id 1 exists
|
||||
'restaurant_id' => 1, // Assuming restaurant_id 1 exists
|
||||
'title' => 'Sample Ticket 1',
|
||||
'description' => 'This is a detailed description of the first ticket.',
|
||||
'purchase_code' => 'PUR12345',
|
||||
'status' => 'open',
|
||||
'read' => true,
|
||||
'related_url' => 'https://example.com',
|
||||
'support_plan' => 'Premium',
|
||||
'attachments' => json_encode(['attachment1.png', 'attachment2.pdf']),
|
||||
'last_conversation_time' => now()->subHours(2),
|
||||
'last_respond_by_client_at' => now()->subDay(),
|
||||
'created_at' => now()->subDays(2),
|
||||
'updated_at' => now()->subDay(),
|
||||
],
|
||||
[
|
||||
'readable_ticket_id' => Str::random(6),
|
||||
'user_id' => 2,
|
||||
'category_id' => 2,
|
||||
'restaurant_id' => 1, // No project assigned
|
||||
'title' => 'Sample Ticket 2',
|
||||
'description' => 'This is another detailed description for the second ticket.',
|
||||
'purchase_code' => 'PUR67890',
|
||||
'status' => 'pending',
|
||||
'read' => false,
|
||||
'related_url' => null,
|
||||
'support_plan' => 'Standard',
|
||||
'attachments' => json_encode([]),
|
||||
'last_conversation_time' => null,
|
||||
'last_respond_by_client_at' => null,
|
||||
'created_at' => now()->subDays(5),
|
||||
'updated_at' => now()->subDays(4),
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user