Files
filament-whatsapp-conector/database/migrations/create_whatsapp_messages_table.php.stub
Wallace Martins 3bf496e8a9 feat: initial release v0.1.0
- Evolution API v2 integration with full HTTP client
- WhatsApp instance management (Create, Connect, Delete, LogOut, Restart)
- Real-time QR Code display with Alpine.js countdown timer
- Pairing code support for WhatsApp Web linking
- Webhook endpoint for receiving Evolution API events
- Complete instance settings (reject calls, always online, read messages, etc.)
- Filament v4 Resource with modal QR Code after instance creation
- Table actions for Connect, View, and Edit
- Status badges with Filament's native components
- Full translations support (English and Portuguese)
- Native Filament multi-tenancy support
- DTOs with Spatie Laravel Data for type safety
- Laravel Events for extensibility
- Background job processing for webhooks and messages
- Comprehensive configuration file
2025-12-07 10:14:40 -03:00

52 lines
1.6 KiB
Plaintext

<?php
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use WallaceMartinss\FilamentEvolution\Database\Migrations\Concerns\HasTenantColumn;
return new class extends Migration
{
use HasTenantColumn;
public function up(): void
{
Schema::create('whatsapp_messages', function (Blueprint $table) {
$table->uuid('id')->primary();
// Dynamic tenant column based on config
$this->addTenantColumn($table);
$table->foreignUuid('instance_id')
->constrained('whatsapp_instances')
->cascadeOnDelete();
$table->string('message_id')->index();
$table->string('remote_jid');
$table->string('phone');
$table->string('direction'); // incoming, outgoing
$table->string('type')->default('text');
$table->text('content')->nullable();
$table->json('media')->nullable();
$table->string('status')->default('pending');
$table->json('raw_payload')->nullable();
$table->timestamp('sent_at')->nullable();
$table->timestamp('delivered_at')->nullable();
$table->timestamp('read_at')->nullable();
$table->timestamps();
$table->index(['instance_id', 'phone']);
$table->index(['instance_id', 'created_at']);
$table->index('direction');
$table->index('status');
});
}
public function down(): void
{
Schema::dropIfExists('whatsapp_messages');
}
};