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