reconstruction of the project
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\View;
|
||||
use App\Controllers\BaseController;
|
||||
use App\Models\SettingsModel;
|
||||
|
||||
class SettingsController extends BaseController
|
||||
{
|
||||
protected $settingsModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->settingsModel = new SettingsModel();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
// Retrieve current settings from the database
|
||||
$settings = $this->settingsModel->getSettings();
|
||||
$timezones = timezone_identifiers_list();
|
||||
|
||||
// Pass the settings and timezones to the view
|
||||
return view('administrator/settings', ['settings' => $settings, 'timezones' => $timezones]);
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
// Handle the form submission to update settings
|
||||
$data = [
|
||||
'site_name' => $this->request->getPost('site_name'),
|
||||
'administrator_email' => strtolower($this->request->getPost('administrator_email')),
|
||||
'timezone' => $this->request->getPost('timezone'),
|
||||
];
|
||||
$this->settingsModel->updateSettings($data);
|
||||
return redirect()->to('/administrator/settings');
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user