phpvms/app/Widgets/LatestNews.php
2018-01-10 16:02:33 -06:00

26 lines
508 B
PHP

<?php
namespace App\Widgets;
use App\Repositories\NewsRepository;
class LatestNews extends BaseWidget
{
protected $config = [
'count' => 5,
];
/**
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function run()
{
$newsRepo = app(NewsRepository::class);
return $this->view('widgets.latest_news', [
'config' => $this->config,
'news' => $newsRepo->recent($this->config['count']),
]);
}
}