39 lines
892 B
PHP
39 lines
892 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Concerns\HasUlids;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
|
|
|
class Turno extends Model
|
|
{
|
|
use HasUlids;
|
|
|
|
protected $table = 'turnos';
|
|
|
|
protected $fillable = ['fecha', 'numero_caja', 'numero_turno', 'fondo'];
|
|
|
|
protected $casts = [
|
|
'fecha' => 'date',
|
|
];
|
|
|
|
public function ingresos(): HasMany
|
|
{
|
|
return $this->hasMany(Ingreso::class, 'turno_id');
|
|
}
|
|
public function egresos(): HasMany
|
|
{
|
|
return $this->hasMany(Egreso::class, 'turno_id');
|
|
}
|
|
public function documentos(): HasMany
|
|
{
|
|
return $this->hasMany(Documento::class, 'turno_id');
|
|
}
|
|
public function efectivo(): HasOne
|
|
{
|
|
return $this->hasOne(Efectivo::class, 'turno_id');
|
|
}
|
|
}
|