1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 20:52:56 +01:00

migration for client registration fields

This commit is contained in:
David Bomba 2023-03-01 10:20:22 +11:00
parent 33df867438
commit 52d4997945

View File

@ -0,0 +1,41 @@
<?php
use App\Models\Company;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Company::query()->cursor()->each(function ($company){
$crfs = $company->client_registration_fields;
foreach($crfs as $key => $crf)
{
$crfs[$key]['visible'] = $crfs[$key]['required'];
}
$company->client_registration_fields = $crfs;
$company->save();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
};