2025-09-12 13:06:36 -07:00

50 lines
874 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Empresa extends Model
{
use HasFactory;
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'empresas';
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'nombre',
'rfc',
'direccion',
'telefono',
'email',
'activo'
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'activo' => 'boolean',
];
/**
* Scope para obtener solo empresas activas
*/
public function scopeActivas($query)
{
return $query->where('activo', true);
}
}