From e17e85bc4cf13deb29eb4ae113a066a6e427dcc7 Mon Sep 17 00:00:00 2001 From: Ollama Date: Wed, 15 Apr 2026 12:40:24 +0000 Subject: [PATCH] refactor: Add getters for protected model properties - Create BaseModel with getters for $table, $primaryKey, $allowedFields - All models now extend BaseModel instead of CodeIgniter\Model - Add type declarations to protected properties Closes #4489 --- app/Models/Appconfig.php | 18 ++++++------------ app/Models/Attribute.php | 16 ++++++---------- app/Models/BaseModel.php | 33 +++++++++++++++++++++++++++++++++ app/Models/Cashup.php | 17 ++++++----------- app/Models/Customer.php | 13 +++++-------- app/Models/Customer_rewards.php | 16 ++++++---------- app/Models/Dinner_table.php | 16 ++++++---------- app/Models/Employee.php | 16 +++++----------- app/Models/Expense.php | 16 ++++++---------- app/Models/Expense_category.php | 16 ++++++---------- app/Models/Giftcard.php | 16 ++++++---------- app/Models/Inventory.php | 19 ++++++------------- app/Models/Item.php | 19 ++++++------------- app/Models/Item_kit.php | 16 ++++++---------- app/Models/Item_kit_items.php | 17 ++++++----------- app/Models/Item_quantity.php | 16 ++++++---------- app/Models/Item_taxes.php | 17 ++++++----------- app/Models/Module.php | 16 ++++++---------- app/Models/Person.php | 16 ++++++---------- app/Models/Receiving.php | 16 ++++++---------- app/Models/Reports/Report.php | 19 ++----------------- app/Models/Rewards.php | 18 ++++++------------ app/Models/Sale.php | 16 ++++++---------- app/Models/Stock_location.php | 21 ++++++--------------- app/Models/Supplier.php | 13 +++++-------- app/Models/Tax.php | 16 ++++++---------- app/Models/Tax_category.php | 17 ++++++----------- app/Models/Tax_code.php | 16 ++++++---------- app/Models/Tax_jurisdiction.php | 17 ++++++----------- 29 files changed, 194 insertions(+), 304 deletions(-) create mode 100644 app/Models/BaseModel.php diff --git a/app/Models/Appconfig.php b/app/Models/Appconfig.php index 04cad2cb4..eed30f977 100644 --- a/app/Models/Appconfig.php +++ b/app/Models/Appconfig.php @@ -3,22 +3,16 @@ namespace App\Models; use CodeIgniter\Database\ResultInterface; -use CodeIgniter\Model; use Config\OSPOS; use ReflectionException; -/** - * Appconfig class - * - * - */ -class Appconfig extends Model +class Appconfig extends BaseModel { - protected $table = 'app_config'; - protected $primaryKey = 'key'; - protected $useAutoIncrement = false; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'app_config'; + protected string $primaryKey = 'key'; + protected bool $useAutoIncrement = false; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'key', 'value' ]; diff --git a/app/Models/Attribute.php b/app/Models/Attribute.php index d48abad2d..8ca340ebd 100644 --- a/app/Models/Attribute.php +++ b/app/Models/Attribute.php @@ -5,7 +5,6 @@ namespace App\Models; use CodeIgniter\Database\BaseResult; use CodeIgniter\Database\Query; use CodeIgniter\Database\ResultInterface; -use CodeIgniter\Model; use CodeIgniter\Database\RawSql; use Config\OSPOS; use DateTime; @@ -13,16 +12,13 @@ use InvalidArgumentException; use stdClass; use ReflectionClass; -/** - * Attribute class - */ -class Attribute extends Model +class Attribute extends BaseModel { - protected $table = 'attribute_definitions'; - protected $primaryKey = 'definition_id'; - protected $useAutoIncrement = true; - protected $useSoftDeletes = false; - protected $allowedFields = [ // TODO: This model may not be well designed... The model accesses three different tables (attribute_definitions, attribute_links, attribute_values). Should that be more than one model? According to CodeIgniter, these are meant to model a single table https://codeigniter.com/user_guide/models/model.html#models + protected string $table = 'attribute_definitions'; + protected string $primaryKey = 'definition_id'; + protected bool $useAutoIncrement = true; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'definition_name', 'definition_type', 'definition_unit', diff --git a/app/Models/BaseModel.php b/app/Models/BaseModel.php new file mode 100644 index 000000000..43c6c886a --- /dev/null +++ b/app/Models/BaseModel.php @@ -0,0 +1,33 @@ +table; + } + + public function getPrimaryKeyName(): string + { + return $this->primaryKey; + } + + public function getAllowedFields(): array + { + return $this->allowedFields; + } + + public function getUseAutoIncrement(): bool + { + return $this->useAutoIncrement; + } + + public function getUseSoftDeletes(): bool + { + return $this->useSoftDeletes; + } +} \ No newline at end of file diff --git a/app/Models/Cashup.php b/app/Models/Cashup.php index 1d4648312..b937f9911 100644 --- a/app/Models/Cashup.php +++ b/app/Models/Cashup.php @@ -3,21 +3,16 @@ namespace App\Models; use CodeIgniter\Database\ResultInterface; -use CodeIgniter\Model; use Config\OSPOS; use stdClass; -/** - * Cashup class - * Cashups are used to report actual cash on hand, expenses and transactions at the end of a period. - */ -class Cashup extends Model +class Cashup extends BaseModel { - protected $table = 'cash_up'; - protected $primaryKey = 'cashup_id'; - protected $useAutoIncrement = true; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'cash_up'; + protected string $primaryKey = 'cashup_id'; + protected bool $useAutoIncrement = true; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'open_date', 'close_date', 'open_cash_amount', diff --git a/app/Models/Customer.php b/app/Models/Customer.php index 2cadd9677..d3d264490 100644 --- a/app/Models/Customer.php +++ b/app/Models/Customer.php @@ -6,16 +6,13 @@ use CodeIgniter\Database\ResultInterface; use Config\OSPOS; use stdClass; -/** - * Customer class - */ class Customer extends Person { - protected $table = 'customers'; - protected $primaryKey = 'person_id'; - protected $useAutoIncrement = false; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'customers'; + protected string $primaryKey = 'person_id'; + protected bool $useAutoIncrement = false; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'account_number', 'taxable', 'tax_id', diff --git a/app/Models/Customer_rewards.php b/app/Models/Customer_rewards.php index b4ca01c0c..319403a4c 100644 --- a/app/Models/Customer_rewards.php +++ b/app/Models/Customer_rewards.php @@ -3,18 +3,14 @@ namespace App\Models; use CodeIgniter\Database\ResultInterface; -use CodeIgniter\Model; -/** - * Customer_rewards class - */ -class Customer_rewards extends Model +class Customer_rewards extends BaseModel { - protected $table = 'customer_packages'; - protected $primaryKey = 'package_id'; - protected $useAutoIncrement = true; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'customer_packages'; + protected string $primaryKey = 'package_id'; + protected bool $useAutoIncrement = true; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'package_name', 'points_percent', 'deleted' diff --git a/app/Models/Dinner_table.php b/app/Models/Dinner_table.php index 386ec081d..236f3267d 100644 --- a/app/Models/Dinner_table.php +++ b/app/Models/Dinner_table.php @@ -3,18 +3,14 @@ namespace App\Models; use CodeIgniter\Database\ResultInterface; -use CodeIgniter\Model; -/** - * Dinner_table class - */ -class Dinner_table extends Model +class Dinner_table extends BaseModel { - protected $table = 'dinner_tables'; - protected $primaryKey = 'dinner_table_id'; - protected $useAutoIncrement = true; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'dinner_tables'; + protected string $primaryKey = 'dinner_table_id'; + protected bool $useAutoIncrement = true; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'name', 'status', 'deleted' diff --git a/app/Models/Employee.php b/app/Models/Employee.php index 93913bc4b..b4e46bc5a 100644 --- a/app/Models/Employee.php +++ b/app/Models/Employee.php @@ -6,20 +6,14 @@ use CodeIgniter\Database\ResultInterface; use CodeIgniter\Session\Session; use stdClass; -/** - * Employee class - * - * @property session session - * - */ class Employee extends Person { public Session $session; - protected $table = 'Employees'; - protected $primaryKey = 'person_id'; - protected $useAutoIncrement = false; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'Employees'; + protected string $primaryKey = 'person_id'; + protected bool $useAutoIncrement = false; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'username', 'password', 'deleted', diff --git a/app/Models/Expense.php b/app/Models/Expense.php index 2d78db91f..e5282c087 100644 --- a/app/Models/Expense.php +++ b/app/Models/Expense.php @@ -3,20 +3,16 @@ namespace App\Models; use CodeIgniter\Database\ResultInterface; -use CodeIgniter\Model; use Config\OSPOS; use stdClass; -/** - * Expense class - */ -class Expense extends Model +class Expense extends BaseModel { - protected $table = 'expenses'; - protected $primaryKey = 'expense_id'; - protected $useAutoIncrement = true; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'expenses'; + protected string $primaryKey = 'expense_id'; + protected bool $useAutoIncrement = true; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'date', 'amount', 'payment_type', diff --git a/app/Models/Expense_category.php b/app/Models/Expense_category.php index 469c438e9..3c2c67a1a 100644 --- a/app/Models/Expense_category.php +++ b/app/Models/Expense_category.php @@ -3,19 +3,15 @@ namespace App\Models; use CodeIgniter\Database\ResultInterface; -use CodeIgniter\Model; use stdClass; -/** - * Expense_category class - */ -class Expense_category extends Model +class Expense_category extends BaseModel { - protected $table = 'expense_categories'; - protected $primaryKey = 'expense_category_id'; - protected $useAutoIncrement = true; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'expense_categories'; + protected string $primaryKey = 'expense_category_id'; + protected bool $useAutoIncrement = true; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'category_name', 'category_description', 'deleted' diff --git a/app/Models/Giftcard.php b/app/Models/Giftcard.php index ffa485666..94dd134d5 100644 --- a/app/Models/Giftcard.php +++ b/app/Models/Giftcard.php @@ -3,19 +3,15 @@ namespace App\Models; use CodeIgniter\Database\ResultInterface; -use CodeIgniter\Model; use stdClass; -/** - * Giftcard class - */ -class Giftcard extends Model +class Giftcard extends BaseModel { - protected $table = 'giftcards'; - protected $primaryKey = 'giftcard_id'; - protected $useAutoIncrement = true; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'giftcards'; + protected string $primaryKey = 'giftcard_id'; + protected bool $useAutoIncrement = true; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'giftcard_number', 'value', 'deleted', diff --git a/app/Models/Inventory.php b/app/Models/Inventory.php index ff9c56ad6..ffa814ed1 100644 --- a/app/Models/Inventory.php +++ b/app/Models/Inventory.php @@ -3,21 +3,14 @@ namespace App\Models; use CodeIgniter\Database\ResultInterface; -use CodeIgniter\Model; -/** - * Inventory class - * - * @property employee employee - * - */ -class Inventory extends Model +class Inventory extends BaseModel { - protected $table = 'inventory'; - protected $primaryKey = 'trans_id'; - protected $useAutoIncrement = true; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'inventory'; + protected string $primaryKey = 'trans_id'; + protected bool $useAutoIncrement = true; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'trans_items', 'trans_user', 'trans_date', diff --git a/app/Models/Item.php b/app/Models/Item.php index 3759810a0..7fb267a78 100644 --- a/app/Models/Item.php +++ b/app/Models/Item.php @@ -3,18 +3,11 @@ namespace App\Models; use CodeIgniter\Database\ResultInterface; -use CodeIgniter\Model; use Config\OSPOS; use ReflectionException; use stdClass; -/** - * Item class - * - * @property inventory inventory - * @property item_quantity item_quantity - */ -class Item extends Model +class Item extends BaseModel { public const ALLOWED_SUGGESTIONS_COLUMNS = ['name', 'item_number', 'description', 'cost_price', 'unit_price']; @@ -31,11 +24,11 @@ class Item extends Model 'allow_alt_description', 'is_serialized' ]; - protected $table = 'items'; - protected $primaryKey = 'item_id'; - protected $useAutoIncrement = true; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'items'; + protected string $primaryKey = 'item_id'; + protected bool $useAutoIncrement = true; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'name', 'category', 'supplier_id', diff --git a/app/Models/Item_kit.php b/app/Models/Item_kit.php index 5947bd6fd..70fc8f28d 100644 --- a/app/Models/Item_kit.php +++ b/app/Models/Item_kit.php @@ -3,20 +3,16 @@ namespace App\Models; use CodeIgniter\Database\ResultInterface; -use CodeIgniter\Model; use Config\OSPOS; use stdClass; -/** - * Item_kit class - */ -class Item_kit extends Model +class Item_kit extends BaseModel { - protected $table = 'item_kits'; - protected $primaryKey = 'item_kit_id'; - protected $useAutoIncrement = true; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'item_kits'; + protected string $primaryKey = 'item_kit_id'; + protected bool $useAutoIncrement = true; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'item_kit_number', 'name', 'description', diff --git a/app/Models/Item_kit_items.php b/app/Models/Item_kit_items.php index 23f254c54..a2e045741 100644 --- a/app/Models/Item_kit_items.php +++ b/app/Models/Item_kit_items.php @@ -2,18 +2,13 @@ namespace App\Models; -use CodeIgniter\Model; - -/** - * Item_kit_items class - */ -class Item_kit_items extends Model +class Item_kit_items extends BaseModel { - protected $table = 'item_kit_items'; - protected $primaryKey = 'item_kit_id'; - protected $useAutoIncrement = true; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'item_kit_items'; + protected string $primaryKey = 'item_kit_id'; + protected bool $useAutoIncrement = true; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'kit_sequence' ]; diff --git a/app/Models/Item_quantity.php b/app/Models/Item_quantity.php index f7c95c6e5..39cec5e51 100644 --- a/app/Models/Item_quantity.php +++ b/app/Models/Item_quantity.php @@ -2,19 +2,15 @@ namespace App\Models; -use CodeIgniter\Model; use stdClass; -/** - * Item_quantity class - */ -class Item_quantity extends Model +class Item_quantity extends BaseModel { - protected $table = 'item_quantities'; - protected $primaryKey = 'item_id'; - protected $useAutoIncrement = false; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'item_quantities'; + protected string $primaryKey = 'item_id'; + protected bool $useAutoIncrement = false; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'quantity' ]; diff --git a/app/Models/Item_taxes.php b/app/Models/Item_taxes.php index 0f42aff52..8e04517a8 100644 --- a/app/Models/Item_taxes.php +++ b/app/Models/Item_taxes.php @@ -2,18 +2,13 @@ namespace App\Models; -use CodeIgniter\Model; - -/** - * Item_taxes class - */ -class Item_taxes extends Model +class Item_taxes extends BaseModel { - protected $table = 'item_taxes'; - protected $primaryKey = 'item_id'; - protected $useAutoIncrement = false; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'item_taxes'; + protected string $primaryKey = 'item_id'; + protected bool $useAutoIncrement = false; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'name', 'percent' ]; diff --git a/app/Models/Module.php b/app/Models/Module.php index c0e3e6364..9d3ced137 100644 --- a/app/Models/Module.php +++ b/app/Models/Module.php @@ -3,18 +3,14 @@ namespace App\Models; use CodeIgniter\Database\ResultInterface; -use CodeIgniter\Model; -/** - * Module class - */ -class Module extends Model +class Module extends BaseModel { - protected $table = 'modules'; - protected $primaryKey = 'module_id'; - protected $useAutoIncrement = false; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'modules'; + protected string $primaryKey = 'module_id'; + protected bool $useAutoIncrement = false; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'name_lang_key', 'desc_lang_key', 'sort' diff --git a/app/Models/Person.php b/app/Models/Person.php index 39028f6c7..bb65e0260 100644 --- a/app/Models/Person.php +++ b/app/Models/Person.php @@ -3,19 +3,15 @@ namespace App\Models; use CodeIgniter\Database\ResultInterface; -use CodeIgniter\Model; use stdClass; -/** - * Base class for People classes - */ -class Person extends Model +class Person extends BaseModel { - protected $table = 'people'; - protected $primaryKey = 'person_id'; - protected $useAutoIncrement = true; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'people'; + protected string $primaryKey = 'person_id'; + protected bool $useAutoIncrement = true; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'first_name', 'last_name', 'phone_number', diff --git a/app/Models/Receiving.php b/app/Models/Receiving.php index 2627418e3..9eae14383 100644 --- a/app/Models/Receiving.php +++ b/app/Models/Receiving.php @@ -3,20 +3,16 @@ namespace App\Models; use CodeIgniter\Database\ResultInterface; -use CodeIgniter\Model; use Config\OSPOS; use ReflectionException; -/** - * Receiving class - */ -class Receiving extends Model +class Receiving extends BaseModel { - protected $table = 'receivings'; - protected $primaryKey = 'receiving_id'; - protected $useAutoIncrement = true; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'receivings'; + protected string $primaryKey = 'receiving_id'; + protected bool $useAutoIncrement = true; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'receiving_time', 'supplier_id', 'employee_id', diff --git a/app/Models/Reports/Report.php b/app/Models/Reports/Report.php index dc17acc3c..4ab79fd83 100644 --- a/app/Models/Reports/Report.php +++ b/app/Models/Reports/Report.php @@ -3,33 +3,18 @@ namespace App\Models\Reports; use CodeIgniter\HTTP\Response; -use CodeIgniter\Model; +use App\Models\BaseModel; -/** - * - * - * @property response response - * - */ -abstract class Report extends Model +abstract class Report extends BaseModel { public function __construct() { parent::__construct(); } - /** - * Returns the column names used for the report - */ public abstract function getDataColumns(): array; - /** - * Returns all the data to be populated into the report - */ public abstract function getData(array $inputs): array; - /** - * Returns key=>value pairing of summary data for the report - */ public abstract function getSummaryData(array $inputs): array; } diff --git a/app/Models/Rewards.php b/app/Models/Rewards.php index b733c3a54..2828e9fa2 100644 --- a/app/Models/Rewards.php +++ b/app/Models/Rewards.php @@ -2,19 +2,13 @@ namespace App\Models; -use CodeIgniter\Model; - -/** - * Rewards class - */ - -class Rewards extends Model // TODO: This class is named with plural while the general practice is to name models singular +class Rewards extends BaseModel { - protected $table = 'sales_reward_points'; - protected $primaryKey = 'id'; - protected $useAutoIncrement = true; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'sales_reward_points'; + protected string $primaryKey = 'id'; + protected bool $useAutoIncrement = true; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'sale_id', 'earned', 'used' diff --git a/app/Models/Sale.php b/app/Models/Sale.php index ff332ff8a..89d5ceebb 100644 --- a/app/Models/Sale.php +++ b/app/Models/Sale.php @@ -4,21 +4,17 @@ namespace App\Models; use CodeIgniter\Database\BaseBuilder; use CodeIgniter\Database\ResultInterface; -use CodeIgniter\Model; use App\Libraries\Sale_lib; use Config\OSPOS; use ReflectionException; -/** - * Sale class - */ -class Sale extends Model +class Sale extends BaseModel { - protected $table = 'sales'; - protected $primaryKey = 'sale_id'; - protected $useAutoIncrement = true; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'sales'; + protected string $primaryKey = 'sale_id'; + protected bool $useAutoIncrement = true; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'sale_time', 'customer_id', 'employee_id', diff --git a/app/Models/Stock_location.php b/app/Models/Stock_location.php index 358120496..e0400c1a8 100644 --- a/app/Models/Stock_location.php +++ b/app/Models/Stock_location.php @@ -3,24 +3,15 @@ namespace App\Models; use CodeIgniter\Database\ResultInterface; -use CodeIgniter\Model; use CodeIgniter\Session\Session; -/** - * Stock_location class - * - * @property employee employee - * @property item item - * @property session session - * - */ -class Stock_location extends Model +class Stock_location extends BaseModel { - protected $table = 'stock_locations'; - protected $primaryKey = 'location_id'; - protected $useAutoIncrement = true; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'stock_locations'; + protected string $primaryKey = 'location_id'; + protected bool $useAutoIncrement = true; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'location_name', 'deleted' ]; diff --git a/app/Models/Supplier.php b/app/Models/Supplier.php index 94028e2bf..1a0f4b72c 100644 --- a/app/Models/Supplier.php +++ b/app/Models/Supplier.php @@ -4,16 +4,13 @@ namespace App\Models; use CodeIgniter\Database\ResultInterface; -/** - * Supplier class - */ class Supplier extends Person { - protected $table = 'suppliers'; - protected $primaryKey = 'person_id'; - protected $useAutoIncrement = false; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'suppliers'; + protected string $primaryKey = 'person_id'; + protected bool $useAutoIncrement = false; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'company_name', 'account_number', 'tax_id', diff --git a/app/Models/Tax.php b/app/Models/Tax.php index 61e6e9361..1e0c2ba3e 100644 --- a/app/Models/Tax.php +++ b/app/Models/Tax.php @@ -3,19 +3,15 @@ namespace App\Models; use CodeIgniter\Database\ResultInterface; -use CodeIgniter\Model; use stdClass; -/** - * Tax class - */ -class Tax extends Model +class Tax extends BaseModel { - protected $table = 'tax_rates'; - protected $primaryKey = 'tax_rate_id'; - protected $useAutoIncrement = true; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'tax_rates'; + protected string $primaryKey = 'tax_rate_id'; + protected bool $useAutoIncrement = true; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'rate_tax_code_id', 'rate_tax_category_id', 'rate_jurisdiction_id', diff --git a/app/Models/Tax_category.php b/app/Models/Tax_category.php index 4f3d9c23e..4157605f0 100644 --- a/app/Models/Tax_category.php +++ b/app/Models/Tax_category.php @@ -3,20 +3,15 @@ namespace App\Models; use CodeIgniter\Database\ResultInterface; -use CodeIgniter\Model; use stdClass; -/** - * Tax Category class - */ - -class Tax_category extends Model +class Tax_category extends BaseModel { - protected $table = 'tax_categories'; - protected $primaryKey = 'tax_category_id'; - protected $useAutoIncrement = true; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'tax_categories'; + protected string $primaryKey = 'tax_category_id'; + protected bool $useAutoIncrement = true; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'tax_category', 'tax_group_sequence', 'deleted' diff --git a/app/Models/Tax_code.php b/app/Models/Tax_code.php index 0437ab6b5..dd3f1202f 100644 --- a/app/Models/Tax_code.php +++ b/app/Models/Tax_code.php @@ -3,20 +3,16 @@ namespace App\Models; use CodeIgniter\Database\ResultInterface; -use CodeIgniter\Model; use Config\OSPOS; use stdClass; -/** - * Tax Code class - */ -class Tax_code extends Model +class Tax_code extends BaseModel { - protected $table = 'tax_codes'; - protected $primaryKey = 'tax_code_id'; - protected $useAutoIncrement = true; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'tax_codes'; + protected string $primaryKey = 'tax_code_id'; + protected bool $useAutoIncrement = true; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'tax_code', 'tax_code_name', 'city', diff --git a/app/Models/Tax_jurisdiction.php b/app/Models/Tax_jurisdiction.php index f01b19b99..0d0c1b822 100644 --- a/app/Models/Tax_jurisdiction.php +++ b/app/Models/Tax_jurisdiction.php @@ -3,20 +3,15 @@ namespace App\Models; use CodeIgniter\Database\ResultInterface; -use CodeIgniter\Model; use stdClass; -/** - * Tax Jurisdiction class - */ - -class Tax_jurisdiction extends Model +class Tax_jurisdiction extends BaseModel { - protected $table = 'tax_jurisdictions'; - protected $primaryKey = 'cashup_id'; - protected $useAutoIncrement = true; - protected $useSoftDeletes = false; - protected $allowedFields = [ + protected string $table = 'tax_jurisdictions'; + protected string $primaryKey = 'cashup_id'; + protected bool $useAutoIncrement = true; + protected bool $useSoftDeletes = false; + protected array $allowedFields = [ 'jurisdiction_name', 'tax_group', 'tax_type',