id(); $table->uuid('uuid')->nullable()->unique(); $table->foreignId('project_id')->constrained()->onDelete('cascade'); $table->foreignId('layer_id')->constrained()->onDelete('cascade'); $table->string('feature_id'); // ID del elemento GeoJSON $table->foreignId('template_id')->nullable()->constrained('inspection_templates')->onDelete('set null'); $table->foreignId('user_id')->constrained(); $table->json('data'); // Valores de los campos del template $table->enum('status', ['pending', 'in_progress', 'completed', 'approved', 'rejected'])->default('pending'); $table->foreignId('inspector_user_id')->nullable()->constrained('users')->nullOnDelete(); $table->timestamp('completed_at')->nullable(); $table->enum('result', ['pass', 'fail', 'conditional'])->nullable(); $table->text('notes')->nullable(); $table->timestamp('client_updated_at')->nullable(); $table->timestamps(); $table->softDeletes(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('inspections'); } };