<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * @property mixed replies
 */
class VisitorMessage extends Model
{
    //use soft delete
    use SoftDeletes;

    protected $fillable = [
        'name',
        'email',
        'phone',
        'subject_id',
        'message',
        'read',
        'reply'
    ];


    /**
     * Return all replies for message
     * @return HasMany
     */
    public function replies() :HasMany
    {
        return $this->hasMany(VisitorMessageReply::class);
    }

    public function subject()
    {
        return $this->belongsTo(Choise::class,'subject_id')->withTrashed();
    }

}
