<?php

class ProductQuant extends Eloquent {
  
	protected $table = "storage_product_types";
	protected $softDelete	 = true;
	protected $fillable = array('project_id', 'product_id', 'product_type_id', 'quant', 'quant_blocked');
	protected $guarded		 = array();
	public static $rules	 = array();

	public function product() {
		return $this->belongsTo('Product');
	}

	public function productType() {
		return $this->belongsTo('ProductType');
	}

	public function saveProductQuantHistory($productId = null, $productGroupId = null, $productTypeId = null, $addedQuant = null, $oldQuant = null, $addedQuantBlocked = null, $oldQuantBlocked = null, $message) {
	  StorageRefrence::create(array(
								'product_id'			    => $productId,
								'product_group_id'    => $productGroupId,
								'product_type_id'	    => $productTypeId,
								'added_quant'	        => $addedQuant,
								'old_quant'	          => $oldQuant,
				        'added_quant_blocked' => $addedQuantBlocked,
								'old_quant_blocked'	  => $oldQuantBlocked,
								'comment'	            => $message,
								'sender_user_id'	    => Sentry::getUser()->id
		));
	}
	
}
