TaoLer/app/common/model/UserZan.php

38 lines
778 B
PHP
Raw Normal View History

2020-01-01 13:17:19 +08:00
<?php
2022-08-02 21:13:36 +08:00
/*
* @Author: TaoLer <317927823@qq.com>
* @Date: 2021-12-06 16:04:50
* @LastEditTime: 2022-07-18 18:32:40
* @LastEditors: TaoLer
* @Description: 优化版
* @FilePath: \TaoLer\app\common\model\UserZan.php
* Copyright (c) 2020~2022 https://www.aieok.com All rights reserved.
*/
2020-01-01 13:17:19 +08:00
namespace app\common\model;
use think\Model;
class UserZan extends Model
{
protected $autoWriteTimestamp = true; //开启自动时间戳
protected $createTime = 'create_time';
public function comment()
{
2023-07-03 12:50:57 +08:00
//关联评论
2020-01-01 13:17:19 +08:00
return $this->belongsTo('Comment','comment_id','id');
}
public function user()
{
2023-07-03 12:50:57 +08:00
//关联用户
2020-01-01 13:17:19 +08:00
return $this->belongsTo('User','user_id','id');
}
2022-08-02 21:13:36 +08:00
public function article()
{
2023-07-03 12:50:57 +08:00
//关联文章
2022-08-02 21:13:36 +08:00
return $this->belongsTo(Article::class);
}
2020-01-01 13:17:19 +08:00
}