<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class MProvinsi extends Model
{
    use HasFactory;

    protected $table = "m_provinsi";
    protected $primaryKey = 'id_provinsi';
    public $timestamps = false;
    protected $fillable = [
    ];
    public static function checkExist($id)
    {
        return self::where('id_provinsi',$id);
    }
    public static function select_q($id_provinsi){
        $query = "SELECT m_provinsi.* from m_provinsi";
        $query .= " where m_provinsi.deleted = 1";
        if ($id_provinsi != 0)
        {
            $query .= " and m_provinsi.id_provinsi = ".$id_provinsi;
        }
        return DB::select($query);
    }
}
