mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
copiada la rama presu_cliente_v2 en esta para poder hacer el merge al main
This commit is contained in:
@ -33,7 +33,6 @@ class ConfigVariables extends BaseResourceController
|
||||
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->configVariableModel = model(ConfigVariableModel::class);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -48,45 +47,46 @@ class ConfigVariables extends BaseResourceController
|
||||
|
||||
return view(static::$viewPath . $this->indexRoute, $viewData);
|
||||
}
|
||||
public function store(){
|
||||
public function store()
|
||||
{
|
||||
$data = [];
|
||||
$variableCreated = $this->configVariableModel->store($data);
|
||||
return $this->response->setJSON($variableCreated);
|
||||
}
|
||||
public function get(int $config_variable_id){
|
||||
public function get(int $config_variable_id)
|
||||
{
|
||||
$data = $this->configVariableModel->find($config_variable_id);
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
public function updateVariable(int $config_variable_id){
|
||||
public function updateVariable(int $config_variable_id)
|
||||
{
|
||||
$reqData = [];
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
$status = $this->configVariableModel->update($config_variable_id,$reqData);
|
||||
$status = $this->configVariableModel->update($config_variable_id, $reqData);
|
||||
return $this->response->setJSON([
|
||||
"message" => "Variable actualizada correctamente",
|
||||
"status" => $status
|
||||
]);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
public function deleteVariable(int $config_variable_id): Response
|
||||
{
|
||||
return $this->response->setJSON([]);
|
||||
|
||||
}
|
||||
public function datatable(){
|
||||
public function datatable()
|
||||
{
|
||||
|
||||
$query = $this->configVariableModel->builder()->select([
|
||||
"id",
|
||||
"name",
|
||||
"value",
|
||||
"description"])->orderBy("name","asc");
|
||||
"description"
|
||||
])->orderBy("name", "asc");
|
||||
return DataTable::of($query)
|
||||
->add("action",fn($q) => $q->id)
|
||||
->toJson(true);
|
||||
->add("action", fn($q) => $q->id)
|
||||
->toJson(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user