42 lines
870 B
PHP
42 lines
870 B
PHP
<?php
|
|
|
|
|
|
namespace app\models;
|
|
|
|
use app\models\parsed\NavigationParsed;
|
|
|
|
|
|
/**
|
|
* Class Navigation
|
|
* @package app\models
|
|
* @property string $menu_type
|
|
* @property string $name
|
|
* @property string $ts_en_name
|
|
* @property int $order_index
|
|
* @property int $page_id
|
|
* @property $url
|
|
* @property $url_authorised
|
|
* @property $relation_type
|
|
* [relations]
|
|
* @property Pages $page
|
|
* @property NavigationParsed $parsed
|
|
* @property $partner_page
|
|
* @property $is_active
|
|
* @property $in_submenu
|
|
*/
|
|
class Navigation extends _Base
|
|
{
|
|
public function getPage() {
|
|
return $this->hasOne(Pages::class, ['id' => 'page_id']);
|
|
}
|
|
public function getParsed()
|
|
{
|
|
return new NavigationParsed($this);
|
|
}
|
|
public static function getLinkById($id)
|
|
{
|
|
$link = self::findOne($id);
|
|
return $link ? $link->parsed->relation : "#";
|
|
}
|
|
}
|