Laravel 11, Vuexy Admin 10.3, by admin@koneko.mx
This commit is contained in:
51
modules/Admin/App/Models/Sat/Municipio.php
Normal file
51
modules/Admin/App/Models/Sat/Municipio.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\App\Models\Sat;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Municipio extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'sat_municipio';
|
||||
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $fillable = [
|
||||
'c_municipio',
|
||||
'c_estado',
|
||||
'descripcion',
|
||||
'fecha_de_inicio_de_vigencia',
|
||||
'fecha_de_fin_de_vigencia',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'fecha_de_inicio_de_vigencia' => 'datetime',
|
||||
'fecha_de_fin_de_vigencia' => 'datetime',
|
||||
];
|
||||
|
||||
|
||||
public static function selectList($c_estado, $c_municipio = false)
|
||||
{
|
||||
return self::select('c_municipio', 'descripcion')
|
||||
->where('c_estado', $c_estado)
|
||||
->when($c_municipio, function ($query) use ($c_municipio) {
|
||||
$query->where('c_municipio', $c_municipio);
|
||||
})
|
||||
->orderBy('descripcion')
|
||||
->pluck('descripcion', 'c_municipio');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user