<?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',
        'message',
        'read',
        'reply'
    ];


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

    public function subject() :belongsTo
    {
        return $this->belongsTo(Subject::class)->withTrashed();
    }

}
