<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use App\Traits\ModelTrait;

class Message extends Model
{
    use ModelTrait;

    protected $table = 'messages';

    protected $guarded = ['captcha', 'g-recaptcha-response', 'key'];

    public function langs()
    {
        return $this->hasOne(Lang::class, 'slug', 'lang');
    }

    public function product()
    {
        return $this->belongsTo(Product::class, 'product_id', 'id');
    }

    /**
     * 获取团队人员信息
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function user()
    {
        return $this->belongsTo(User::class, 'user_id', 'id');
    }
}
