mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en el formulario de añadir
This commit is contained in:
@ -5,20 +5,57 @@ namespace App\Models\Soporte;
|
||||
|
||||
class TicketModel extends \App\Models\BaseModel
|
||||
{
|
||||
protected $table = 'tickets';
|
||||
|
||||
protected $table = 'tickets';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = ['usuario_id', 'tecnico_id', 'categoria_id', 'estado_id', 'prioridad', 'titulo', 'descripcion', 'created_at', 'updated_at'];
|
||||
|
||||
protected $useTimestamps = true;
|
||||
|
||||
public function getEstados()
|
||||
{
|
||||
$values = $this->db->table('tickets_estados')->get()->getResultArray();
|
||||
$data = [];
|
||||
|
||||
foreach ($values as $value) {
|
||||
$data[$value['keyword']] = lang("Tickets." . $value['keyword']);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getCategorias()
|
||||
{
|
||||
$values = $this->db->table('tickets_categorias')->get()->getResultArray();
|
||||
$data = [];
|
||||
|
||||
foreach ($values as $value) {
|
||||
$data[$value['keyword']] = lang("Tickets." . $value['keyword']);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getSecciones()
|
||||
{
|
||||
$values = $this->db->table('tickets_secciones')->get()->getResultArray();
|
||||
$data = [];
|
||||
|
||||
foreach ($values as $value) {
|
||||
$data[$value['keyword']] = lang("Tickets." . $value['keyword']);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getTickets($id = null)
|
||||
{
|
||||
if ($id === null) {
|
||||
return $this->select('tickets.*, users.nombre as usuario, categorias.nombre as categoria, estados.nombre as estado')
|
||||
->join('users', 'users.id = tickets.usuario_id')
|
||||
->join('categorias', 'categorias.id = tickets.categoria_id')
|
||||
->join('estados', 'estados.id = tickets.estado_id')
|
||||
->findAll();
|
||||
->join('users', 'users.id = tickets.usuario_id')
|
||||
->join('categorias', 'categorias.id = tickets.categoria_id')
|
||||
->join('estados', 'estados.id = tickets.estado_id')
|
||||
->findAll();
|
||||
}
|
||||
|
||||
return $this->find($id);
|
||||
|
||||
Reference in New Issue
Block a user