<?php

class VisitUtmCampaignBudget extends Eloquent {

	use SoftDeletingTrait;

	protected $guarded		 = array();
	public static $rules	 = array();

	public function user() {
		return $this->belongsTo('User')->withTrashed()->remember(60);
	}

	public function project() {
		return $this->belongsTo('Project');
	}

	public function visitUtmCampaign() {
		return $this->belongsTo('VisitUtmCampaign');
	}

	public function setAmountAttribute($value) {
		$value											 = str_replace(',', '.', $value);
		$value											 = str_replace(' ', '', $value);
		$this->attributes['amount']	 = round($value * 100, 0);
	}

	public function getAmountAttribute() {
		return round($this->attributes['amount'] / 100, 2);
	}

}
