File: /var/www/html/laravel/database/migrations/2026_03_05_081509_update_notam_gpt_requests.php
<?php
use App\Models\Notam;
use App\Models\NotamGptRequest;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
$notamGptRequests = NotamGptRequest::query()
->get();
foreach ($notamGptRequests as $notamGptRequest) {
echo "Processing {$notamGptRequest->id}\n";
$notam = new Notam();
$validationErrors = $notam->validateDataFormat($notamGptRequest->output);
if (!count($validationErrors)
|| (count($validationErrors) == 1 && substr_count($validationErrors[0], 'CheckNeeded'))) {
$notamGptRequest->is_valid = 1;
} else {
$notamGptRequest->is_valid = 0;
}
$notamGptRequest->save();
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
}
};