SiteMsg.php 459 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace app\common\model;
  3. use think\db\Query;
  4. use think\Model;
  5. /**
  6. * @method static Query|static hot($hot=1)
  7. */
  8. class SiteMsg extends Model
  9. {
  10. protected $autoWriteTimestamp=true;
  11. protected $updateTime=null;
  12. public function read(){
  13. return $this->hasMany(SiteMsgRead::class);
  14. }
  15. protected static function init()
  16. {
  17. self::afterDelete(function (self $msg){
  18. $msg->read()->delete();
  19. });
  20. }
  21. }