37 рядки
816 B
PHP

<?php
namespace App\Models;
use CodeIgniter\Model;
class PrestadorModel extends Model
{
protected $table = 'prestador';
protected $primaryKey = 'idprestador';
protected $useTimestamps = false;
protected $allowedFields = [
'nombre', 'apaterno', 'amaterno', 'fechanac',
'direccion', 'colonia', 'municipio', 'cp',
'telefono', 'celular', 'email',
'idescuela', 'carrera', 'grado', 'turno',
'tipo', 'fechainicio', 'iddepartamento_actual', 'horas_servicio',
];
// GUARDAR COMO NOMBRE
// turno, tipo
function getPrestador($id = null)
{
return $this->where('idprestador', $id)->first();
}
function countPrestadoresActivos()
{
return $this
->where('status', 0)
->countAllResults();
}
}