Initial import
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?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']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user