<?php

namespace Hilco\Models;
class CurrencyRate extends WebModel {
    protected $table = 'CurrencyRates';

    public function scopeCurrent($query) {
        $currency = b2b()->activeCurrency();
        return $query
            ->where($currency, '>', 0)
            ->orderBy('year', 'DESC')
            ->orderBy('month', 'DESC')
            ->take(1)
            ;
    }
}
