<?php

namespace App\Models\Messagewall;

use Illuminate\Database\Eloquent\Model;
use App\Models\User\UserModel;

/**
 * App\Models\Messagewall\MessagewallModel
 *
 * @property int $id
 * @property int $master_uid 被留言者
 * @property int $guest_uid 留言者
 * @property string $content 留言内容
 * @property \Illuminate\Support\Carbon $created_at 创建时间
 * @property \Illuminate\Support\Carbon $updated_at 修改时间
 * @property \Illuminate\Support\Carbon $deleted_at 删除时间
 * @property-read \App\Models\User\UserModel $user
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Messagewall\MessagewallModel newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Messagewall\MessagewallModel newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Messagewall\MessagewallModel query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Messagewall\MessagewallModel whereContent($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Messagewall\MessagewallModel whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Messagewall\MessagewallModel whereDeletedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Messagewall\MessagewallModel whereGuestUid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Messagewall\MessagewallModel whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Messagewall\MessagewallModel whereMasterUid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Messagewall\MessagewallModel whereUpdatedAt($value)
 * @mixin \Eloquent
 */
class MessagewallModel extends Model
{
    //
    protected $table = 'kdgx_fpdx_messagewall';

    protected $dateFormat = 'U';

    protected $dates = ['created_at', 'updated_at', 'deleted_at'];

    public $fillable = ['master_uid', 'guest_uid', 'content', 'deleted_at'];

    protected $hidden = ['deleted_at'];

    public function user()
    {
        return $this->belongsTo(UserModel::class, 'guest_uid', 'uid')->select('nickname', 'headimgurl', 'sex');
    }
}
