Advertisement
strogj

model Comments

Apr 22nd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.91 KB | None | 0 0
  1. <?php
  2.  
  3. namespace app\models;
  4.  
  5. use Yii;
  6. use yii\db\ActiveRecord;
  7. use yii\behaviors\TimestampBehavior;
  8.  
  9. /**
  10.  * CommentsForm is the model behind the comments form.
  11.  */
  12. class Comments extends ActiveRecord
  13. {
  14.  
  15.     public static function tableName()
  16.     {
  17.         return 'comments';
  18.     }
  19.  
  20.     public function rules()
  21.     {
  22.         return [
  23.             /* nick and comment body are both required */
  24.             [[ 'body'], 'required'],
  25.         ];
  26.     }
  27.  
  28.  
  29.     public function attributeLabels()
  30.     {
  31.         return [
  32.             'id' => Yii::t('app', 'ID'),
  33.             'body' => Yii::t('app', 'Body'),
  34.             'created_at' => Yii::t('app', 'Created At'),
  35.             'update_at' => Yii::t('app', 'Update At'),
  36.             'status' => Yii::t('app', 'Status'),
  37.  
  38.         ];
  39.     }
  40.  
  41.     public function behaviors()
  42.     {
  43.         return [
  44.             TimestampBehavior::className(),
  45.         ];}
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement