diff --git a/app/Console/Commands/CheckData.php b/app/Console/Commands/CheckData.php index 11d4cbc196..cc236aac36 100644 --- a/app/Console/Commands/CheckData.php +++ b/app/Console/Commands/CheckData.php @@ -991,7 +991,7 @@ class CheckData extends Command if ($this->option('fix') == 'true') { - Vendor::query()->whereNull('currency_id')->cursor()->each(function ($vendor){ + Vendor::query()->whereNull('currency_id')->orWhere('currency_id', '')->cursor()->each(function ($vendor){ $vendor->currency_id = $vendor->company->settings->currency_id; $vendor->save(); diff --git a/database/migrations/2022_12_14_004639_vendor_currency_update.php b/database/migrations/2022_12_14_004639_vendor_currency_update.php new file mode 100644 index 0000000000..990af9e211 --- /dev/null +++ b/database/migrations/2022_12_14_004639_vendor_currency_update.php @@ -0,0 +1,34 @@ +whereNull('currency_id')->orWhere('currency_id', '')->cursor()->each(function ($vendor){ + + $vendor->currency_id = $vendor->company->settings->currency_id; + $vendor->save(); + + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +};