<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use DateTimeInterface;

class Comment extends Model
{
    use HasFactory;
    protected $table='comment';
    protected $guarded=[];
    protected function serializeDate(DateTimeInterface $date): string
    {
        return $date->format('Y-m-d H:i:s');
    }

    public function user(){
        return $this->hasOne(DwbsUser::class,'id','user_id')->withTrashed();
    }

    public function article(){
        return $this->hasOne(Article::class,'id','article_id');
    }
}
