55 lines
1.1 KiB
PHP
55 lines
1.1 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 文件功能:婚姻亲密度日志 Model
|
||
|
|
*
|
||
|
|
* 对应 marriage_intimacy_logs 表,记录婚姻亲密度的每一次变更。
|
||
|
|
* 亲密度属于婚姻对,独立于用户个人的 user_currency_logs。
|
||
|
|
*
|
||
|
|
* @author ChatRoom Laravel
|
||
|
|
*
|
||
|
|
* @version 1.0.0
|
||
|
|
*/
|
||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
|
||
|
|
class MarriageIntimacyLog extends Model
|
||
|
|
{
|
||
|
|
/** 无 updated_at 字段 */
|
||
|
|
public const UPDATED_AT = null;
|
||
|
|
|
||
|
|
/** @var list<string> */
|
||
|
|
protected $fillable = [
|
||
|
|
'marriage_id',
|
||
|
|
'amount',
|
||
|
|
'balance_after',
|
||
|
|
'source',
|
||
|
|
'remark',
|
||
|
|
];
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 字段类型转换。
|
||
|
|
*
|
||
|
|
* @return array<string, string>
|
||
|
|
*/
|
||
|
|
protected function casts(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'amount' => 'integer',
|
||
|
|
'balance_after' => 'integer',
|
||
|
|
'created_at' => 'datetime',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 所属婚姻关系。
|
||
|
|
*/
|
||
|
|
public function marriage(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(Marriage::class);
|
||
|
|
}
|
||
|
|
}
|