If you have Category model with slug column, then this route will catch them all (note a colon : in {category:slug}):
Route::get('/{category:slug}', [PagesController::class, 'category'])->name('page.category');
In PagesController you can have your category as a model ready for using:
// PagesController.php
public function category(Category $category)
{
// do what you want with $category model
}
You shouldn't generate anything manually.
https://laravel.com/docs/12.x/routing#customizing-the-default-key-name