<?php

namespace App\Repositories;

use Illuminate\Support\Str;
use Illuminate\Database\Eloquent\Model;

class Filter extends Model
{
	protected $guarded = ['id'];

	protected $appends = ['slug'];

	public $timestamps = false;

	public function getSlugAttribute()
	{
		return $this->id . '-' . Str::slug($this->title);
	}

	public function items()
	{
		return $this->hasMany(FilterItem::class)->orderBy('title');
	}
}
