phpvms/app/Widgets/LatestPilots.php

30 lines
593 B
PHP
Raw Normal View History

<?php
namespace App\Widgets;
use App\Interfaces\Widget;
use App\Repositories\UserRepository;
2018-02-21 12:33:09 +08:00
/**
* Show the latest pilots in a view
*/
class LatestPilots extends Widget
{
protected $config = [
'count' => 5,
];
/**
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function run()
{
$userRepo = app(UserRepository::class);
return view('widgets.latest_pilots', [
'config' => $this->config,
2018-09-04 20:02:16 +08:00
'users' => $userRepo->with(['airline'])->recent($this->config['count']),
]);
}
}