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

@ -33,10 +33,10 @@ class Auth extends Model
public function time($time = null)
{
if ($time == null) {
return Carbon::parse($this->time, config('app.timezone'));
return Carbon::parse($this->time, $this->container->get('settings')->app->timezone);
}
if (!\is_a($time, \DateTime::class)) {
$time = Carbon::parse($time, config('app.timezone'));
$time = Carbon::parse($time, $this->container->get('settings')->app->timezone);
}
$this->time = $time;
}
@ -52,9 +52,9 @@ class Auth extends Model
if ($this->status == 0) {
return false;
}
$now = Carbon::now(config('app.timezone'));
$now = Carbon::now($this->container->get('settings')->app->timezone);
$diff = $now->diffAsCarbonInterval($this->time, true);
if ($diff->totalHours > config('app.login_hours')) {
if ($diff->totalHours > $this->container->get('settings')->app->login->hours) {
return false;
}
return true;

View File

@ -22,8 +22,8 @@ class UF extends NewModel
public function getValor()
{
$fecha = Carbon::parse($this->fecha, config('app.timezone'));
$uf = uf($fecha);
$fecha = Carbon::parse($this->fecha, $this->container->get('settings')->app->timezone);
$uf = $this->container->get('uf')($fecha);
if ($uf != null) {
$this->valor = $uf->uf->value;

View File

@ -29,11 +29,11 @@ class Tema extends NewModel
}
public function inicio()
{
return Carbon::parse($this->inicio, config('app.timezone'));
return Carbon::parse($this->inicio, $this->container->get('settings')->app->timezone);
}
public function cierre()
{
return Carbon::parse($this->cierre, config('app.timezone'));
return Carbon::parse($this->cierre, $this->container->get('settings')->app->timezone);
}
public function texto()
{

View File

@ -45,14 +45,14 @@ class Cierre extends NewModel
}
public function fecha()
{
return Carbon::parse($this->fecha, config('app.timezone'));
return Carbon::parse($this->fecha, $this->container->get('settings')->app->timezone);
}
public function pie($type = 'ufs')
{
if ($type == 'ufs') {
return $this->pie;
}
$uf = uf($this->fecha());
$uf = $this->container->get('uf')($this->fecha());
return $this->pie * $uf->uf->value;
}
}

View File

@ -70,7 +70,7 @@ class Venta extends NewModel
}
public function fechaPromesa()
{
return Carbon::parse($this->fecha_promesa, config('app.timezone'));
return Carbon::parse($this->fecha_promesa, $this->container->get('settings')->app->timezone);
}
public function premios()

View File

@ -25,7 +25,7 @@ class AvanceConstruccion 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');
}
@ -52,7 +52,7 @@ class AvanceConstruccion extends Model
public function uf()
{
if ($this->uf == 0) {
$uf = uf($this->fecha());
$uf = $this->container->get('uf')($this->fecha());
if ($uf->total > 0) {
$this->uf = $uf->uf->value;
$this->save();
@ -70,7 +70,7 @@ class AvanceConstruccion extends Model
public function fechaPago(\DateTime $fecha = null)
{
if ($fecha == null) {
return Carbon::parse($this->fecha_pagado, config('app.timezone'));
return Carbon::parse($this->fecha_pagado, $this->container->get('settings')->app->timezone);
}
$this->fecha_pagado = $fecha->format('Y-m-d');
}

View File

@ -18,7 +18,7 @@ class EstadoProyectoAgente 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

@ -33,14 +33,14 @@ class Pagare 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');
}
public function fechaBanco(\DateTime $fecha = null)
{
if ($fecha == null) {
return Carbon::parse($this->fecha_banco, config('app.timezone'));
return Carbon::parse($this->fecha_banco, $this->container->get('settings')->app->timezone);
}
$this->fecha_banco = $fecha->format('Y-m-d');
}
@ -51,7 +51,7 @@ class Pagare extends Model
public function uf()
{
if ($this->uf == 0 and $this->fecha != '0000-00-00') {
$uf = uf($this->fecha());
$uf = $this->container->get('uf')($this->fecha());
if ($uf->total > 0) {
$this->uf = $uf->uf->value;
$this->save();

View File

@ -546,7 +546,7 @@ class Proyecto extends Model
if (isset($this->cuotas)) {
$cuotas = (array) $this->cuotas;
}
$f = Carbon::today(config('app.timezone'));
$f = Carbon::today($this->container->get('settings')->app->timezone);
$cuotas['hoy'] = model(Venta::class)
->join('propiedad', ['propiedad.id', '=', 'venta.propiedad'])
->join('unidad', ['unidad.id', '=', 'propiedad.unidad_principal'])
@ -570,7 +570,7 @@ class Proyecto extends Model
if (isset($this->cuotas)) {
$cuotas = (array) $this->cuotas;
}
$f = Carbon::today(config('app.timezone'));
$f = Carbon::today($this->container->get('settings')->app->timezone);
$cuotas['pendientes'] = model(Cuota::class)
->join('venta', ['cuota.pie', '=', 'venta.pie'])
->join('propiedad', ['propiedad.id', '=', 'venta.propiedad'])
@ -594,7 +594,7 @@ class Proyecto extends Model
if (isset($this->cuotas)) {
$cuotas = (array) $this->cuotas;
}
$f = Carbon::today(config('app.timezone'));
$f = Carbon::today($this->container->get('settings')->app->timezone);
$cuotas['mes'] = model(Cuota::class)
->join('venta', ['cuota.pie', '=', 'venta.pie'])
->join('propiedad', ['propiedad.id', '=', 'venta.propiedad'])

View File

@ -23,14 +23,14 @@ class RenovacionPagare 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');
}
public function fechaBanco(\DateTime $fecha = null)
{
if ($fecha == null) {
return Carbon::parse($this->fecha_banco, config('app.timezone'));
return Carbon::parse($this->fecha_banco, $this->container->get('settings')->app->timezone);
}
$this->fecha_banco = $fecha->format('Y-m-d');
}
@ -41,7 +41,7 @@ class RenovacionPagare extends Model
public function uf()
{
if ($this->uf == 0) {
$uf = uf($this->fecha());
$uf = $this->container->get('uf')($this->fecha());
if ($uf->total > 0) {
$this->uf = $uf->uf->value;
$this->save();

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;
}

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

@ -21,7 +21,7 @@ class EstadoPago 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

@ -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;
}