<?php
namespace Incoviba\nuevo\Common;

use Incoviba\Common\Alias\NewModel;
use Carbon\Carbon;

/**
 * 
 * @author Aldarien
 * @property Date fecha
 * @property double valor
 *
 */
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);
    	
    	if ($uf != null) {
    		$this->valor = $uf->uf->value;
    	}
    }
    
}
