Container

This commit is contained in:
2020-01-07 12:25:52 -03:00
parent 2300ca5641
commit 782e79dd30
19 changed files with 60 additions and 60 deletions

View File

@ -69,7 +69,7 @@ class Cierre extends Model
public function fecha(\DateTime $fecha = null)
{
if ($fecha == null) {
return Carbon::parse($this->fecha, $this->container->get('settings')->app->timezone);//, config('app.timezone'));
return Carbon::parse($this->fecha, $this->container->get('settings')->app->timezone);
}
$this->fecha = $fecha->format('Y-m-d');
}
@ -234,7 +234,7 @@ class Cierre extends Model
if (isset($input->subrelacionado) and $input->subrelacionado) {
$this->relacionado = 2;
}
$fecha = Carbon::today(config('app.timezone'));
$fecha = Carbon::today($this->container->get('settings')->app->timezone);
$this->new($fecha);
$data = [
@ -350,7 +350,7 @@ class Cierre extends Model
return ($this->relacionado == 2) ? true : false;
}
public function periodo() {
$today = Carbon::today(config('app.timezone'));
$today = Carbon::today($this->container->get('settings')->app->timezone);
$dif = $today->diffInDays($this->fecha());
return $dif;
}
@ -360,6 +360,6 @@ class Cierre extends Model
if ($this->propietario()) {
$arr['propietario'] = $this->propietario()->asArray();
}
return $arr;
return $arr;
}
}

View File

@ -23,7 +23,7 @@ class EstadoCierre extends Model
public function fecha(\DateTime $fecha = null)
{
if ($fecha == null) {
return Carbon::parse($this->fecha, config('app.timezone'));
return Carbon::parse($this->fecha, $this->container->get('settings')->app->timezone);
}
$this->fecha = $fecha->format('Y-m-d');
}

View File

@ -14,14 +14,14 @@ use Carbon\Carbon;
*
*/
class EstadoPago extends Model
{
{
public function tipo()
{
return $this->belongs_to(TipoEstadoPago::class, 'estado')->findOne();
}
public function fecha()
{
return Carbon::parse($this->fecha, config('app.timezone'));
return Carbon::parse($this->fecha, $this->container->get('settings')->app->timezone);
}
}
?>

View File

@ -19,7 +19,7 @@ class EstadoPrecio extends Model
public function fecha($fecha = null)
{
if ($fecha == null) {
return Carbon::parse($this->fecha, config('app.timezone'));
return Carbon::parse($this->fecha, $this->container->get('settings')->app->timezone);
}
if (is_a($fecha, \DateTime::class)) {
$fecha = $fecha->format('Y-m-d');

View File

@ -19,7 +19,7 @@ class EstadoUnidadBloqueada extends Model
public function fecha(\DateTime $fecha = null)
{
if ($fecha == null) {
return Carbon::parse($this->fecha, config('app.timezone'));
return Carbon::parse($this->fecha, $this->container->get('settings')->app->timezone);
}
$this->fecha = $fecha->format('Y-m-d');
}

View File

@ -22,6 +22,6 @@ class EstadoVenta extends Model
}
public function fecha()
{
return Carbon::parse($this->fecha, config('app.timezone'));
return Carbon::parse($this->fecha, $this->container->get('settings')->app->timezone);
}
}

View File

@ -61,7 +61,7 @@ class Pago extends Model
public function uf()
{
if ($this->uf == 0) {
$uf = uf($this->fecha);
$uf = $this->container->get('uf')($this->fecha);
if (!$uf or $uf->total == 0) {
return 1;
}

View File

@ -196,7 +196,7 @@ class Pie extends Model
public function uf()
{
if ($this->uf == 0) {
$uf = uf($this->fecha);
$uf = $this->container->get('uf')($this->fecha);
if (!$uf) {
return 1;
}

View File

@ -420,7 +420,7 @@ class Venta extends Model
{
if ($this->uf == null) {
$f = $this->fecha();
$uf = uf($f);
$uf = $this->container->get('uf')($f);
if ($uf == null) {
return 1;
}