39 lines
900 B
PHP
39 lines
900 B
PHP
<?php
|
|
|
|
|
|
namespace app\models;
|
|
|
|
/**
|
|
* 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 $relation_type
|
|
* @property $is_active
|
|
* @property $in_submenu
|
|
* [relations]
|
|
* @property Pages $page
|
|
*/
|
|
class Navigation extends _Base
|
|
{
|
|
public function getPage() {
|
|
return $this->hasOne(Pages::class, ['id' => 'page_id']);
|
|
}
|
|
|
|
public function isRelationType($type) {
|
|
$currentType = $this->relation_type ?? 'inner_page';
|
|
$this->relation_type = $currentType;
|
|
return $type == $currentType ? 'checked' : '';
|
|
}
|
|
public function isRelationTypeFor($type) {
|
|
if($type != $this->relation_type) {
|
|
return 'readonly class="disabled"';
|
|
}
|
|
return '';
|
|
}
|
|
}
|