<?php

namespace App\Modelos;

use Core\Database;

class Motor extends Database
{
    protected $table = 'app_motores';
    protected $id = 'mot_id';

    public function obtenerMotores()
    {
        return $this->consultar("SELECT * 
        FROM app_motores mot 
        JOIN app_marcas m ON m.m_id = mot.mot_marca
        LEFT JOIN app_tipo_motor tip ON tip.tip_id = mot.mot_tipid")->all();
    }

    public function obtenerMotor(int $id_motor)
    {
        return $this->consultar("SELECT * FROM app_motores mot 
        JOIN app_marcas m ON m.m_id = mot.mot_marca 
        LEFT JOIN app_tipo_motor tip ON tip.tip_id = mot.mot_tipid
        WHERE mot_id=$id_motor")->row();
    }
}
