diff --git a/src/Controller/CountryController.php b/src/Controller/CountryController.php index 3afae33..9098994 100644 --- a/src/Controller/CountryController.php +++ b/src/Controller/CountryController.php @@ -3,6 +3,7 @@ namespace Krzysiej\RyobiCrawler\Controller; use Illuminate\Database\Eloquent\Builder; +use Krzysiej\RyobiCrawler\Models\Country; use Krzysiej\RyobiCrawler\Models\Product; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Attribute\Route; @@ -20,6 +21,8 @@ final class CountryController extends BaseController ->orderByDesc('created_by') ->get(); - return $this->render('productList.html.twig', ['products' => $products, 'listType' => 'country']); + $country = Country::where('countryName', $country)->first(); + + return $this->render('productList.html.twig', ['products' => $products, 'listType' => 'country', 'country' => $country]); } } diff --git a/templates/productList.html.twig b/templates/productList.html.twig index 09fe110..e385a03 100644 --- a/templates/productList.html.twig +++ b/templates/productList.html.twig @@ -19,6 +19,10 @@ {% endif %} + {% if listType == 'country' and country is not null%} +

{{ country.countryName }}

+ {% endif %} + {% if (listType starts with 'category_' and category == null) or not (listType starts with 'category_') or (listType starts with 'category_' and category is not null) %}