<?php

namespace App\Models;

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

class Like extends Model
{
    use HasFactory;
    protected $table='like';
    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 course(): \Illuminate\Database\Eloquent\Relations\HasOne
    {
        return $this->hasOne(Course::class,'id','course_id');
    }
}
