Files
fdesk/app/common/model/InquiryLog.php
T
2025-07-22 15:13:53 +08:00

82 lines
1.6 KiB
PHP

<?php
namespace app\common\model;
use support\Model;
use app\common\model\User;
use app\common\model\Country;
class InquiryLog extends Model
{
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'mysql';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'inquiry_log';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = true;
protected $dateFormat = 'U';
/**
* 允许自动填充模型字段
*/
protected $fillable = [
'id', 'order_no', 'enter_user_id', 'recipient',
'quality', 'channel', 'email', 'tel', 'whatsapp',
'country', 'contacts', 'content', 'status',
'r_time', 't_time', 'created_at', 'updated_at'
];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
public function enter()
{
return $this->hasOne(User::class, 'id', 'enter_user_id');
}
public function recipient()
{
return $this->hasOne(User::class, 'id', 'recipient');
}
// public function enter()
// {
// return $this->belongsTo(User::class, 'enter_user_id');
// }
// public function recipient()
// {
// return $this->belongsTo(User::class, 'recipient');
// }
public function country()
{
return $this->hasOne(Country::class, 'id', 'country');
}
}