feat: add backstage/filament-mails

This commit is contained in:
idevakk
2025-09-28 22:43:41 +05:30
parent 5325eb34cd
commit 122c4d8f89
18 changed files with 619 additions and 2 deletions

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::create(config('mails.database.tables.mails'), function (Blueprint $table) {
$table->id();
$table->string('uuid')->nullable()->index();
$table->string('mail_class')->nullable()->index();
$table->string('subject')->nullable();
$table->json('from')->nullable();
$table->json('reply_to')->nullable();
$table->json('to')->nullable();
$table->json('cc')->nullable();
$table->json('bcc')->nullable();
$table->text('html')->nullable();
$table->text('text')->nullable();
$table->unsignedBigInteger('opens')->default(0);
$table->unsignedBigInteger('clicks')->default(0);
$table->timestamp('sent_at')->nullable();
$table->timestamp('resent_at')->nullable();
$table->timestamp('accepted_at')->nullable();
$table->timestamp('delivered_at')->nullable();
$table->timestamp('last_opened_at')->nullable();
$table->timestamp('last_clicked_at')->nullable();
$table->timestamp('complained_at')->nullable();
$table->timestamp('soft_bounced_at')->nullable();
$table->timestamp('hard_bounced_at')->nullable();
$table->timestamp('unsubscribed_at')->nullable();
$table->timestamps();
});
}
};

View File

@@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::create(config('mails.database.tables.attachments', 'mail_attachments'), function (Blueprint $table) {
$table->id();
$table->foreignIdFor(config('mails.models.mail'))
->constrained()
->cascadeOnDelete();
$table->string('disk');
$table->string('uuid');
$table->string('filename');
$table->string('mime');
$table->boolean('inline', false);
$table->bigInteger('size');
$table->timestamps();
});
}
};

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::create(config('mails.database.tables.events', 'mail_events'), function (Blueprint $table) {
$table->id();
$table->foreignIdFor(config('mails.models.mail'))
->constrained()
->cascadeOnDelete();
$table->string('type');
$table->string('ip_address')->nullable();
$table->string('hostname')->nullable();
$table->string('platform')->nullable();
$table->string('os')->nullable();
$table->string('browser')->nullable();
$table->string('user_agent')->nullable();
$table->string('city')->nullable();
$table->char('country_code', 2)->nullable();
$table->string('link')->nullable();
$table->string('tag')->nullable();
$table->json('payload')->nullable();
$table->timestamps();
$table->timestamp('occurred_at')->nullable();
});
}
};

View File

@@ -0,0 +1,19 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::create(config('mails.database.tables.polymorph'), function (Blueprint $table) {
$table->id();
$table->foreignIdFor(config('mails.models.mail'))
->constrained()
->cascadeOnDelete();
$table->morphs('mailable');
});
}
};

View File

@@ -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
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table(config('mails.database.tables.events', 'mail_events'), function (Blueprint $table): void {
$table->timestamp('unsuppressed_at')
->nullable()
->after('occurred_at');
});
Schema::table(config('mails.database.tables.mails', 'mails'), function (Blueprint $table): void {
$table->string('mailer')
->after('uuid');
$table->string('stream_id')
->nullable()
->after('mailer');
});
}
};

View File

@@ -0,0 +1,17 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::table(config('mails.database.tables.mails'), function (Blueprint $table) {
$table->after('clicks', function (Blueprint $table) {
$table->json('tags')->nullable();
});
});
}
};

View File

@@ -0,0 +1,17 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::table(config('mails.database.tables.mails', 'mails'), function (Blueprint $table): void {
$table->string('transport')
->nullable()
->after('mailer');
});
}
};

View File

@@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::table(config('mails.database.tables.mails'), function (Blueprint $table) {
$table->longText('html')->nullable()->change();
$table->longText('text')->nullable()->change();
});
}
public function down()
{
Schema::table(config('mails.database.tables.mails'), function (Blueprint $table) {
$table->text('html')->nullable()->change();
$table->text('text')->nullable()->change();
});
}
};

View File

@@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::table(config('mails.database.tables.events', 'mail_events'), function (Blueprint $table) {
$table->longText('link')->nullable()->change();
});
}
public function down()
{
Schema::table(config('mails.database.tables.events', 'mail_events'), function (Blueprint $table) {
$table->string('link')->nullable()->change();
});
}
};