31 lines
667 B
PHP
31 lines
667 B
PHP
|
<?php
|
||
|
namespace Incoviba\old\Venta;
|
||
|
|
||
|
use Carbon\Carbon;
|
||
|
use Incoviba\Common\Alias\OldModel as Model;
|
||
|
|
||
|
/**
|
||
|
* @property int $id
|
||
|
* @property Cierre $cierre
|
||
|
* @property TipoEstadoCierre $tipo
|
||
|
* @property \DateTime $fecha
|
||
|
*/
|
||
|
class EstadoCierre extends Model
|
||
|
{
|
||
|
public function cierre()
|
||
|
{
|
||
|
return $this->belongsTo(Cierre::class, 'cierre')->findOne();
|
||
|
}
|
||
|
public function tipo()
|
||
|
{
|
||
|
return $this->belongsTo(TipoEstadoCierre::class, 'tipo')->findOne();
|
||
|
}
|
||
|
public function fecha(\DateTime $fecha = null)
|
||
|
{
|
||
|
if ($fecha == null) {
|
||
|
return Carbon::parse($this->fecha, config('app.timezone'));
|
||
|
}
|
||
|
$this->fecha = $fecha->format('Y-m-d');
|
||
|
}
|
||
|
}
|