<?php

namespace App\Models;

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

class Category extends Model
{
    use HasFactory;

    protected $guarded = [];

    public function getAllCategories()
    {
        return \Rinvex\Categories\Models\Category::all();
    }

    public function getPaginatedCategories()
    {
        return \Rinvex\Categories\Models\Category::paginate(20);
    }

    public function getCategoryById(int $id)
    {
        return \Rinvex\Categories\Models\Category::find($id);
    }

    public function getCategoryBySlug(string $slug)
    {
        return \Rinvex\Categories\Models\Category::whereSlug($slug)->first();
    }

}
