Add migration to fix already escaped formats in the database

This commit is contained in:
Ivan Nieto Vivanco 2023-02-12 17:40:04 -06:00
parent 6936efd387
commit 99122ccb50

View file

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use App\Models\CustomField;
class FixUnescapedCustomfieldsFormat extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$customfields = CustomField::where('format', 'LIKE', '%&%')->get();
foreach($customfields as $customfield){
$customfield->update(['format' => html_entity_decode($customfield->format)]);
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}