Контроллер:
Код: Выделить всё
public function actionBrand()
{
$brands = Brand::find()->all();
return $this->render('brand', [
'brands' => $brands,
]);
}
Код: Выделить всё
<?php foreach ($brands as $brand): ?>
<p><a href="<?= Url::to(['site/model', 'slug' => $brand->slug]); ?>"><?= $brand->title; ?></a></p><!--где-то здесь нужно вывести кол-во моделей из базы-->
<?php endforeach; ?>