<?php

namespace App\Models;

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

class Article extends Model
{
    use HasFactory;

    protected $fillable = [
        'title',
        'content',
        'category_id',
    ];
    protected $casts = [
        'published_at' => 'datetime',
    ];
    public function images()
    {
        return $this->hasMany(ArticleImage::class);
    }

    public function category()
    {
        return $this->belongsTo(Category::class);
    }
}
