mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
correct form validation & typo in api dashboard widget
This commit is contained in:
@@ -111,24 +111,24 @@ class Widget extends FHCAPI_Controller
|
|||||||
{
|
{
|
||||||
$this->load->library('form_validation');
|
$this->load->library('form_validation');
|
||||||
|
|
||||||
$this->form_validation->set_rules('dashboard', 'Dashboard', 'required');
|
$this->form_validation->set_rules('dashboard_id', 'Dashboard', 'required');
|
||||||
$this->form_validation->set_rules('widget', 'Widget', 'required');
|
$this->form_validation->set_rules('widget_id', 'Widget', 'required');
|
||||||
$this->form_validation->set_rules('allowed', 'Allowed', 'required|is_bool');
|
$this->form_validation->set_rules('allowed', 'Allowed', 'is_bool');
|
||||||
|
|
||||||
if (!$this->form_validation->run())
|
if (!$this->form_validation->run())
|
||||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'dashboard_id' => $this->input->post('dashboard'),
|
'dashboard_id' => $this->input->post('dashboard_id'),
|
||||||
'widget_id' => $this->input->post('widget')
|
'widget_id' => $this->input->post('widget_id')
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->load->model('dashboard/Dashboard_Widget_model', 'DashboardWidgetModel');
|
$this->load->model('dashboard/Dashboard_Widget_model', 'DashboardWidgetModel');
|
||||||
|
|
||||||
if ($this->input->post('allowed'))
|
if ($this->input->post('allowed'))
|
||||||
$result = $this->DashoardWidgetModel->insert($data);
|
$result = $this->DashboardWidgetModel->insert($data);
|
||||||
else
|
else
|
||||||
$result = $this->DashoardWidgetModel->delete($data);
|
$result = $this->DashboardWidgetModel->delete($data);
|
||||||
|
|
||||||
$data = $this->getDataOrTerminateWithError($result);
|
$data = $this->getDataOrTerminateWithError($result);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user