34 lines
706 B
PHP
34 lines
706 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use CodeIgniter\Model;
|
|
|
|
class SettingsModel extends Model
|
|
{
|
|
protected $table = 'settings';
|
|
protected $primaryKey = 'id';
|
|
protected $allowedFields = [
|
|
'name',
|
|
'timezone',
|
|
'updated_by',
|
|
'created_at',
|
|
'updated_at'
|
|
];
|
|
|
|
protected $useTimestamps = true;
|
|
protected $createdField = 'created_at';
|
|
protected $updatedField = 'updated_at';
|
|
|
|
public function getSettings()
|
|
{
|
|
return $this->findAll()[0]; // Assuming there's only one settings record
|
|
}
|
|
|
|
public function updateSettings($data)
|
|
{
|
|
return $this->update(1, $data); // Assuming there's only one settings record
|
|
}
|
|
}
|
|
?>
|