Add enabled_expense_tax_rates

This commit is contained in:
David Bomba 2022-07-29 09:26:31 +10:00
parent 7357e4026f
commit 1196ea8122
3 changed files with 40 additions and 0 deletions

View File

@ -119,6 +119,7 @@ class Company extends BaseModel
'track_inventory',
'inventory_notification_threshold',
'stock_notification',
'enabled_expense_tax_rates',
];
protected $hidden = [

View File

@ -177,6 +177,7 @@ class CompanyTransformer extends EntityTransformer
'inventory_notification_threshold' => (int) $company->inventory_notification_threshold,
'track_inventory' => (bool) $company->track_inventory,
'enable_applying_payments' => (bool) $company->enable_applying_payments,
'enabled_expense_tax_rates' =. (bool) $company->enabled_expense_tax_rates,
];
}

View File

@ -0,0 +1,38 @@
<?php
use App\Models\Company;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('companies', function (Blueprint $table) {
$table->boolean('enabled_expense_tax_rates')->default(0);
});
Company::query()->where('enabled_item_tax_rates', true)->cursor()->each(function ($company){
$company->enabled_expense_tax_rates = true;
$company->save();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
};