mercredi 3 juin 2020

Re-Ordering Categories In Laravel

I would like to know which libraries can I use to re-arrange and or oder my categories in my Laravel Application.

Product Category Model

class ProductCategory extends Model
{
    use SoftDeletes;

    protected $table = "product_categories";

    protected $fillable = [
        "category_name", "category_description", "category_image", "slug"
    ];

    public function products() {
        return $this->hasMany(Product::class, 'product_category', 'id');
    }

    public function subcategory() {
        return $this->hasMany(ProductSubCategory::class, 'category_id', 'id');
    }
}

My Controller

    public function index() {
        $categories = ProductCategory::with('products', 'subcategory')->get();
        return view('admin.category.index', compact('categories'));
    }

My View I use DataTables

This is the outcome in the view enter image description here

Question

I want to be able to rearrange or order the Categories without using the asc or desc methods? Can you point me to plugin or library to use. The client want to do like wordpress menu.

WordPress



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire