Set default tax id to 1 for all products

This commit is contained in:
David Bomba 2023-04-04 07:36:58 +10:00
parent fbd47c1e40
commit e14656129f
4 changed files with 17 additions and 4 deletions

View File

@ -55,7 +55,7 @@ class TaxModel
{
$this->regions->EU->has_sales_above_threshold = false;
$this->regions->EU->tax_all = false;
$this->regions->EU->tax_all_subregions = false;
$this->regions->EU->vat_threshold = 10000;
$this->euSubRegions();

View File

@ -1,7 +1,7 @@
region:
US:
tax_all: false
seller_region: CA
tax_all_subregions: false
seller_subregion: CA
has_sales_above_threshold: false
subregions:
AL:

View File

@ -35,6 +35,7 @@ class ProductFactory
$product->custom_value3 = '';
$product->custom_value4 = '';
$product->is_deleted = 0;
$product->tax_id = 1;
return $product;
}

View File

@ -2,6 +2,7 @@
use App\Models\Client;
use App\Models\Company;
use App\Models\Product;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -26,6 +27,10 @@ return new class extends Migration
$table->dropColumn('tax_all_products');
});
Schema::table('products', function (Blueprint $table) {
$table->unsignedInteger('tax_id')->nullable(); // the product tax constant
});
Company::query()
->cursor()
->each(function ($company) {
@ -40,6 +45,13 @@ return new class extends Migration
$client->save();
});
Product::query()
->cursor()
->each(function ($product) {
$product->tax_id = 1;
$product->save();
});
}
/**