/**
  * @return \yii\db\ActiveQuery
  */
 public function getPostAttachments()
 {
     return $this->hasMany(PostAttachment::className(), ['post_id' => 'post_id']);
 }
 public static function addPostAttachmentPhoto($post_id, $file)
 {
     $att = new PostAttachment();
     $att->post_id = $post_id;
     $att->file = $file;
     return $att->save();
 }