D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
epaji.com
/
public_html
/
hindiusa
/
models
/
Filename :
News.php
back
Copy
<?php namespace app\models; use Yii; /** * This is the model class for table "news". * * @property int $id * @property int $school_id * @property int $news_category_id * @property string $title * @property string $description * @property string $thumb_image * @property string|null $reference_url * @property string|null $meta_title * @property string|null $meta_description * @property int $status * @property string $created * * @property NewsCategories $newsCategory * @property Schools $school */ class News extends \yii\db\ActiveRecord { public $thumbimage; /** * {@inheritdoc} */ public static function tableName() { return 'news'; } /** * {@inheritdoc} */ public function rules() { return [ [['school_id', 'news_category_id', 'title', 'description', 'thumb_image', 'status', 'created'], 'required'], [['school_id', 'news_category_id', 'status','display_status'], 'integer'], [['description'], 'string'], [['created'], 'safe'], [['title', 'reference_url', 'meta_description'], 'string', 'max' => 500], [['thumb_image', 'meta_title'], 'string', 'max' => 300], [['thumbimage'],'image', 'extensions' => 'jpg,jpeg,png','maxSize' => 900000], [['school_id'], 'exist', 'skipOnError' => true, 'targetClass' => Schools::className(), 'targetAttribute' => ['school_id' => 'id']], [['news_category_id'], 'exist', 'skipOnError' => true, 'targetClass' => NewsCategories::className(), 'targetAttribute' => ['news_category_id' => 'id']], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => Yii::t('app', 'ID'), 'school_id' => Yii::t('app', 'School'), 'news_category_id' => Yii::t('app', 'News Category'), 'title' => Yii::t('app', 'Title'), 'description' => Yii::t('app', 'Description'), 'thumb_image' => Yii::t('app', 'Thumb Image'), 'reference_url' => Yii::t('app', 'Reference URL'), 'meta_title' => Yii::t('app', 'Meta Title'), 'meta_description' => Yii::t('app', 'Meta Description'), 'status' => Yii::t('app', 'Status'), 'created' => Yii::t('app', 'Created'), 'thumbimage' => Yii::t('app', 'Upload News Image'), 'display_status' => Yii::t('app', 'Display for Main Website'), ]; } /** * Gets query for [[NewsCategory]]. * * @return \yii\db\ActiveQuery */ public function getNewsCategory() { return $this->hasOne(NewsCategories::className(), ['id' => 'news_category_id'])->inverseOf('news'); } /** * Gets query for [[School]]. * * @return \yii\db\ActiveQuery */ public function getSchool() { return $this->hasOne(Schools::className(), ['id' => 'school_id'])->inverseOf('news'); } }