CommentInfoModel.php 942 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class CommentInfoModel extends Model
  5. {
  6. protected $table = 'comments_info';
  7. protected $fillable = [
  8. 'interaction_id',
  9. 'user_id',
  10. 'user_avatar',
  11. 'user_nickname',
  12. 'to_user_id',
  13. 'to_user_avatar',
  14. 'to_user_nickname',
  15. 'level',
  16. 'content',
  17. 'is_read',
  18. ];
  19. protected $hidden = ['dream_id','created_at','deleted_at'];
  20. public function CommentUser()
  21. {
  22. return $this->belongsTo('App\Models\UserInfoModel','user_id','id');
  23. }
  24. public function to_user()
  25. {
  26. return $this->belongsTo('App\Models\UserInfoModel');
  27. }
  28. public function dream()
  29. {
  30. return $this->hasOne('App\Models\DreamInfoModel','id','dream_id');
  31. }
  32. public function replay()
  33. {
  34. return $this->hasMany('App\Models\ReplyCommentsInfo','comment_id','id');
  35. }
  36. }