<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;

/**
 * Class AiWriteup
 *
 * @property int $id
 * @property string $source
 * @property string $source_url
 * @property int $category_id
 * @property string $title
 * @property string $editor_format
 * @property string|null $excerpt
 * @property string|null $featured_image
 * @property array|null $body
 * @property float $cost
 * @property Carbon|null $created_at
 * @property Carbon|null $updated_at
 * @property Category $category
 */
class AiWriteup extends Model
{
    protected $table = 'ai_writeups';

    protected $casts = [
        'category_id' => 'int',
        'body' => 'json',
        'cost' => 'float',
    ];

    protected $fillable = [
        'source',
        'source_url',
        'category_id',
        'title',
        'editor_format',
        'excerpt',
        'featured_image',
        'body',
        'cost',
    ];

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