<?php
/*=========================================================================================
    App Name  : PPID PTUN Kupang
    File Name : Article
    --------------------------------------------------------------------------------------
    Author    : Fuad Auliya Rohman
    Email     : fuad.dev16@gmail.com
==========================================================================================*/

namespace App\Models;

use App\Traits\TimestampTrait;
use App\Traits\ActivityLogTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class Article extends Model
{
    use HasFactory, ActivityLogTrait, TimestampTrait, SoftDeletes;

    protected $table      = 'articles';

    protected $fillable = [
        'id',
        'categori_id',
        'tittle',
        'content',
        'youtube',
        'slug',
        'status',
        'publish_date',
        'hits',
        'created_by',
        'updated_by',
        'created_at',
        'updated_at',
        'deleted_at',
    ];

    public function category()
    {
        return $this->belongsTo(Categori::class, 'categori_id', 'id');
    }

    public function user()
    {
        return $this->belongsTo(User::class, 'created_by', 'id');
    }
}
