File: D:/HostingSpaces/SBogers33/bbec.nl/app/Komma/Pages/Models/PageTranslation.php
<?php
/**
* Short description for the file.
*
* @author Komma <support@komma.pro>
* @copyright (c) 2012-2015, Komma Mediadesign
*/
namespace Komma\Pages\Models;
class PageTranslation extends \Komma\Kms\Pages\Models\PageTranslation
{
public $kmsClass = 'Komma\\Kms\\Pages\\Models\\PageTranslation';
/**
* Get the route from the current translation
*
* @return Collection
*/
public function route()
{
/**
* On the Route model is an MorphTo relation
* By using a hasOne relation:
* where the routable_type is filled in with the KmsClass
* And the routable_id is set as the foreign_id,
* we can collect the route of the given model directly.
*
*/
return $this->hasOne('Komma\Routes\Models\Route', 'routable_id')
->where('routable_type', '=', $this->kmsClass);
}
}