Files
chatroom/app/Models/FeedbackVote.php

43 lines
961 B
PHP
Raw Normal View History

<?php
/**
* 文件功能:用户反馈赞同记录 Model
* 对应 feedback_votes 表,记录用户对反馈的赞同行为
* 每个用户每条反馈只能赞同一次(数据库层唯一索引保障)
*
* @author ChatRoom Laravel
*
* @version 1.0.0
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class FeedbackVote extends Model
{
/**
* 关闭 updated_at赞同记录只有创建无需更新时间
*/
public const UPDATED_AT = null;
/**
* 允许批量赋值的字段
*/
protected $fillable = [
'feedback_id',
'user_id',
];
// ═══════════════ 关联关系 ═══════════════
/**
* 关联所属反馈
*/
public function feedback(): BelongsTo
{
return $this->belongsTo(FeedbackItem::class, 'feedback_id');
}
}