File: D:/HostingSpaces/SBogers10/debierbaron.komma.pro/app/Komma/OrderDiscounts/Models/OrderDiscount.php
<?php
/**
* Short description for the file.
*
* @author Tim Van Samang <timvansamang@komma.pro>
* @copyright (c) 2012-2015, Komma Mediadesign
*/
namespace Komma\OrderDiscount\Models;
class OrderDiscount extends \Komma\Kms\OrderDiscounts\Models\OrderDiscount
{
/**
* With this relation we can collect a specific translation
* Based on the locale.
*
* @return mixed
*/
public function translation()
{
return $this->hasOne('Komma\OrderDiscount\Models\OrderDiscountTranslation', 'discount_order_id')
//We only need the translation
->select('discount_orders_translations.*')
//Join the languages
->join('languages', 'languages.id', '=', 'discount_orders_translations.language_id')
//Get only the language with the correct lang
->where('languages.iso_2', '=', \App::getLocale());
}
}