<?php

namespace App\Models;

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

class Category extends Model
{
    use HasFactory;
    protected $table = "category";
    public $timestamps = false;

    public function fetchAllcategory($category_id)
    {
        
        $query = Category::orderBy('id', 'desc');
        if ($category_id  && !empty($category_id) && $category_id != 'all') {
            $query->where('id', $category_id);
        }
       
        return $query;
    }
}
