File: D:/HostingSpaces/SBogers10/rentman.komma.pro/app/Komma/Tables/models/Table.php
<?php
namespace Komma\Tables\Models;
class Table extends \Komma\Kms\Tables\Models\Table
{
public $kmsClass = 'Komma\\Kms\\Tables\\Models\\Table';
/**
* 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\Tables\Models\TableTranslation')
//We only need the translation
->select('table_translations.*')
//Join the languages
->join('languages', 'languages.id', '=', 'table_translations.language_id')
//Get only the language with the correct lang
->where('languages.iso_2', '=', \App::getLocale());
}
}