Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Ary-dev04/DentControl/llms.txt

Use this file to discover all available pages before exploring further.

Overview

The Clinica model represents dental clinic entities in the DentControl system. It serves as the primary tenant model for the multi-tenant SaaS architecture, containing clinic information, location details, and branding configuration.

Table Schema

table
string
default:"clinica"
Database table name
primaryKey
integer
default:"id_clinica"
Primary key column (auto-incrementing)
timestamps
boolean
default:"true"
Includes created_at and updated_at columns

Fields

Basic Information

nombre
string
required
Clinic name
rfc
string
Tax identification number (RFC - Registro Federal de Contribuyentes). Unique and nullable.

Address Fields

calle
string
Street name
numero_ext
string
External street number
numero_int
string
Internal/apartment number
colonia
string
Neighborhood/colony
ciudad
string
City
estado
string
State/province
codigo_postal
string
Postal/ZIP code

Contact & Branding

telefono
string
Primary phone number
logo_ruta
string
File path or URL to clinic logo

Status

estatus
enum
default:"activo"
Clinic status: activo or baja

Relationships

usuarios

Type: hasMany A clinic has many users (dentists, assistants, admins).
$clinica->usuarios; // Collection of Usuario models
Foreign Key: id_clinica on usuario table

pacientes

Type: hasMany A clinic has many patients.
$clinica->pacientes; // Collection of Paciente models
Foreign Key: id_clinica on paciente table

Example Usage

Creating a New Clinic

use App\Models\Clinica;

$clinica = Clinica::create([
    'nombre' => 'Clínica Dental Sonrisa',
    'rfc' => 'CDS010101ABC',
    'calle' => 'Av. Reforma',
    'numero_ext' => '123',
    'colonia' => 'Centro',
    'ciudad' => 'Ciudad de México',
    'estado' => 'CDMX',
    'codigo_postal' => '06000',
    'telefono' => '5555551234',
    'estatus' => 'activo'
]);

Retrieving Clinic with Relationships

// Get clinic with all users
$clinica = Clinica::with('usuarios')->find($id);

// Get clinic with active patients
$clinica = Clinica::with(['pacientes' => function ($query) {
    $query->where('estatus', 'activo');
}])->find($id);

Updating Clinic Information

$clinica = Clinica::find($id);
$clinica->update([
    'telefono' => '5555559999',
    'logo_ruta' => 'storage/logos/clinica-1.png'
]);

Model Definition

Location: app/Models/Clinica.php
protected $fillable = [
    'nombre',
    'rfc',
    'calle',
    'numero_ext',
    'numero_int',
    'colonia',
    'ciudad',
    'estado',
    'codigo_postal',
    'telefono',
    'logo_ruta',
    'estatus'
];

Build docs developers (and LLMs) love