<?php 
namespace App\Models;

use Illuminate\Database\Eloquent\Model;


class Upload extends Model {

	protected $table = 'upload';

	public static function getimageurl($id){
		$upload = Upload::where('id',$id)->first();
		if($upload){
			return $upload->path;
		}
			return '';
	}

	public static function getproductimageurl($id,$type){
		$upload = Upload::where('productid',$id)->first();
		if($upload){
			return $upload->$type;
		}
			return '';
	}

	public static function getproductfeatureimageurl($id,$type){
		$upload = Upload::where('productid',$id)->where('type',$type)->first();
		if($upload){
			return $upload->path;
		}
			return '';
	}

}
