| 1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- /*
- * Миграция: таблица leads — заявки с форм сайта.
- * Создана: 2026-05-07
- * Поля:
- * form_id — ID формы (web_forms), FK с каскадным удалением
- * data — JSON-объект с данными заявки {field_name: value, ...}
- * ip — IP-адрес отправителя
- * read_at — когда менеджер просмотрел заявку (null = новая)
- */
- 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('leads', function (Blueprint $table) {
- $table->id();
- $table->foreignId('form_id')->constrained('web_forms')->cascadeOnDelete();
- $table->json('data');
- $table->string('ip', 45)->nullable();
- $table->timestamp('read_at')->nullable();
- $table->timestamps();
- });
- }
- public function down(): void
- {
- Schema::dropIfExists('leads');
- }
- };
|