<?php

namespace App\Models;

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

class SitePage extends Model
{
    use HasFactory;
    protected $table = 'site_pages';

    protected $casts = [
        'post_date' => 'datetime:Y-m-d'
    ];

    public function tags()
    {
        return $this->belongsToMany(
            SitePageTag::class,
            'site_pages_tag_relationship',
            'pages_id',
            'tag_id'
        );
    }
}
