mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-06-01 04:06:12 -04:00
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
This commit is contained in:
33
app/Models/BaseModel.php
Normal file
33
app/Models/BaseModel.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
abstract class BaseModel extends Model
|
||||
{
|
||||
public function getTableName(): string
|
||||
{
|
||||
return $this->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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user