diff --git a/src/common/Auth.php b/src/common/Auth.php index 1754884..c28ea77 100644 --- a/src/common/Auth.php +++ b/src/common/Auth.php @@ -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; diff --git a/src/nuevo/Common/UF.php b/src/nuevo/Common/UF.php index 53f7329..7d7ec79 100644 --- a/src/nuevo/Common/UF.php +++ b/src/nuevo/Common/UF.php @@ -5,7 +5,7 @@ use Incoviba\Common\Alias\NewModel; use Carbon\Carbon; /** - * + * * @author Aldarien * @property Date fecha * @property double valor @@ -14,20 +14,20 @@ use Carbon\Carbon; class UF extends NewModel { protected static $_table = 'ufs'; - + protected static $_id_column = 'fecha'; protected static $_timestamps = false; - + //public $incrementing = false; - + 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; } } - + } diff --git a/src/nuevo/Proyecto/Tema.php b/src/nuevo/Proyecto/Tema.php index 8f665e5..827d553 100644 --- a/src/nuevo/Proyecto/Tema.php +++ b/src/nuevo/Proyecto/Tema.php @@ -6,7 +6,7 @@ use Incoviba\old\Proyecto\Proyecto as P; use Carbon\Carbon; /** - * + * * @author Aldarien * @property int $id * @property Proyecto $proyecto_id @@ -18,7 +18,7 @@ use Carbon\Carbon; class Tema extends NewModel { protected static $_table = 'temas'; - + public function proyecto() { $proyecto = $this->belongsTo(Proyecto::class)->findOne(); @@ -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() { @@ -46,7 +46,7 @@ class Tema extends NewModel } } $text = implode('
', $text); - + preg_match_all('/\[\[.*\]\]/', $text, $matches); $search = []; $replace = []; @@ -56,7 +56,7 @@ class Tema extends NewModel list($model, $where, $value) = explode(':', str_replace(['[',']'], ['', ''], $match)); $class = '\\Incoviba\\old\\' . $model; $obj = model($class)->where($where, $value)->findOne(); - + $str = $value; if ($obj->venta()) { $str = '