phpvms/app/Widgets/LatestPireps.php
2018-03-11 18:00:42 -05:00

30 lines
579 B
PHP

<?php
namespace App\Widgets;
use App\Repositories\PirepRepository;
/**
* Show the latest PIREPs in a view
* @package App\Widgets
*/
class LatestPireps extends BaseWidget
{
protected $config = [
'count' => 5,
];
/**
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function run()
{
$pirepRepo = app(PirepRepository::class);
return view('widgets.latest_pireps', [
'config' => $this->config,
'pireps' => $pirepRepo->recent($this->config['count']),
]);
}
}