feat: Implement mail campaign feature with CRUD operations and email sending capabilities
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?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('mail_campaigns', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->uuid('uuid')->unique();
|
||||
$table->string('name', 255)->nullable();
|
||||
$table->bigInteger('template_id')->nullable()->index();
|
||||
$table->string('subject', 255);
|
||||
$table->longText('message');
|
||||
$table->unsignedInteger('total_recipients')->default(0);
|
||||
$table->unsignedInteger('sent_count')->default(0);
|
||||
$table->unsignedInteger('failed_count')->default(0);
|
||||
$table->string('status', 20)->default('queued');
|
||||
$table->bigInteger('created_by')->nullable()->index();
|
||||
$table->timestamp('completed_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::table('mail', function (Blueprint $table) {
|
||||
$table->bigInteger('campaign_id')->nullable()->index()->after('id');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('mail', function (Blueprint $table) {
|
||||
$table->dropColumn('campaign_id');
|
||||
});
|
||||
|
||||
Schema::dropIfExists('mail_campaigns');
|
||||
}
|
||||
};
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<?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::table('mail_campaigns', function (Blueprint $table) {
|
||||
$table->string('cc', 1000)->nullable()->after('message');
|
||||
$table->string('bcc', 1000)->nullable()->after('cc');
|
||||
$table->string('recipient_type', 20)->default('selected')->after('bcc');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('mail_campaigns', function (Blueprint $table) {
|
||||
$table->dropColumn(['cc', 'bcc', 'recipient_type']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -21,6 +21,11 @@ class RolesAndPermissions extends Seeder
|
||||
'customer.destroy',
|
||||
'customer.manager',
|
||||
|
||||
// Chiến dịch email
|
||||
'mail-campaign.view',
|
||||
'mail-campaign.create',
|
||||
'mail-campaign.manager',
|
||||
|
||||
// Nhân sự
|
||||
'administrator.view',
|
||||
'administrator.create',
|
||||
|
||||
Reference in New Issue
Block a user