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