39 lines
795 B
PHP
39 lines
795 B
PHP
<?php
|
|
|
|
|
|
namespace app\models;
|
|
|
|
/**
|
|
* Class Pages
|
|
* @package app\models
|
|
* @property $name
|
|
* @property $name_en
|
|
* @property $text
|
|
* @property $text_en
|
|
* @property $slug
|
|
* @property $slug_en
|
|
* @property $id
|
|
* @property $media_key
|
|
* @property \app\models\Contacts $contact
|
|
* @property $price
|
|
* @property $months
|
|
*/
|
|
class Pages extends _Base
|
|
{
|
|
public static function getList($id = null)
|
|
{
|
|
$pages = [];
|
|
foreach (self::find()->all() as $page) {
|
|
if ($page->slug && $page->slug_en)
|
|
$pages[$page->id] = $page->name;
|
|
}
|
|
if ($id && !empty($pages[$id]))
|
|
return $pages[$id];
|
|
return $pages;
|
|
}
|
|
|
|
public function getContact() {
|
|
return $this->hasOne(Contacts::class, ['page_id' => 'id']);
|
|
}
|
|
}
|