You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
576 B
28 lines
576 B
6 years ago
|
<?php
|
||
|
/**
|
||
|
* Created by Error202
|
||
|
* Date: 23.10.2017
|
||
|
*/
|
||
|
|
||
|
namespace app\themes\sport\widgets;
|
||
|
|
||
|
use yii\base\Widget;
|
||
|
use app\modules\blog\repositories\read\PostReadRepository;
|
||
|
|
||
|
class MenuLastPostWidget extends Widget
|
||
|
{
|
||
|
private $repository;
|
||
|
|
||
|
public function __construct(PostReadRepository $repository, $config = [])
|
||
|
{
|
||
|
parent::__construct($config);
|
||
|
$this->repository = $repository;
|
||
|
}
|
||
|
|
||
|
public function run(): string
|
||
|
{
|
||
|
return $this->render('menu-last-posts', [
|
||
|
'posts' => $this->repository->getLast(3)
|
||
|
]);
|
||
|
}
|
||
|
}
|