I have the following route defined:
Route::get('/{brand:slug}-brand-{category:slug}', BrandCategoryController::class)
->where(['brand' => '^[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*$', 'category' => '^[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*$'])
->name('brandcategory');
and BrandCategoryController starts with:
class BrandCategoryController extends Controller
{
public function __invoke(Brand $brand, Category $category)
{
//...
}
}
Now, what I expect would be $brand being route model bounded to Brand with its slug matching, and similar for $category. Instead, Laravel is trying to combine the both, somehow, for some reason, and wants to look for Brand::categories() to call. I'm at the end of my wit... 😔