You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The /categorie/{category} will not load if there isn't a product within that specific category in the database yet.
This is because the category-data is fetched by using the product relation with the category.
The text was updated successfully, but these errors were encountered:
The solution was to import the Category-model within the ProductController.
Then the category data can be directly loaded from the model, without the need of a relation with a product.
use App\Models\Product;
use App\Models\Category;
// Find the category
$categorySlug = basename($request->getRequestUri());
// Get the category data
$categoryData = Category::where('slug', $categorySlug)->first();
The /categorie/{category} will not load if there isn't a product within that specific category in the database yet.
This is because the category-data is fetched by using the product relation with the category.
The text was updated successfully, but these errors were encountered: