| Server IP : 104.21.17.213 / Your IP : 216.73.217.141 Web Server : Apache System : Linux hosting01.arsenalhost.com 4.18.0-425.13.1.lve.el8.x86_64 #1 SMP Mon Feb 27 15:23:24 EST 2023 x86_64 User : corbizre ( 1013) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/corbizre/findnextproperty.com/console/models/ |
Upload File : |
<?php
namespace console\models;
use Yii;
/**
* This is the model class for table "source".
*
* @property integer $ID
* @property string $Source
*/
class Source extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'source';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['Source'], 'string', 'max' => 255]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'ID' => 'ID',
'Source' => 'Source',
];
}
// Найти имя сайта по id;
public static function getSiteName($id){
$model = self::find()->where(['ID'=> $id])->one();
if($model){
return $model->Source;
}else{
echo PHP_EOL,"Sorry,no such site Name in Parser's list yet! Try ID from this list:", PHP_EOL,PHP_EOL;
$modelAll = self::find()->all();
if($modelAll) {
foreach ($modelAll as $site) {
echo 'ID: "' . $site->ID . '", Site Name: "' . $site->Source .'"', PHP_EOL;
}
}
exit;
}
}
}