File: D:/HostingSpaces/EUmans/umansradepo.be/app/Komma/Colleagues/Models/Colleague.php
<?php
/**
* Short description for the file.
*
* @author Tim Van Samang <timvansamang@komma.pro>
* @copyright (c) 2012-2015, Komma Mediadesign
*/
namespace Komma\Colleagues\Models;
class Colleague extends \Komma\Kms\Colleagues\Models\Colleague
{
public $kmsClass = 'Komma\\Kms\\Colleagues\\Models\\Colleague';
protected $connection = 'mysql';
/**
* Get the translation for the current language
*
* @return Collection
*/
public function translation()
{
/**
* On the translation model is an BelongsTo relation.
* We want to collect the current translation.
* Therefore we create a hasOne relation
* Where we will select the page_translation,
* Join on the languages table
* And set the current Locale as the languages.iso_2
*
*/
return $this->hasOne('Komma\Colleagues\Models\ColleagueTranslation')
//We only need the translation
->select('colleague_translations.*')
//Join the languages
->join('languages', 'languages.id', '=', 'colleague_translations.language_id')
//Get only the language with the correct lang
->where('languages.iso_2', '=', \App::getLocale());
}
}