2018-01-10 02:48:24 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Widgets;
|
|
|
|
|
|
|
|
use App\Repositories\AcarsRepository;
|
|
|
|
use App\Services\GeoService;
|
|
|
|
|
2018-02-21 12:33:09 +08:00
|
|
|
/**
|
|
|
|
* Show the live map in a view
|
|
|
|
* @package App\Widgets
|
|
|
|
*/
|
2018-01-10 02:48:24 +08:00
|
|
|
class LiveMap extends BaseWidget
|
|
|
|
{
|
|
|
|
protected $config = [
|
|
|
|
'height' => '800px',
|
|
|
|
'width' => '100%',
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
|
|
|
*/
|
|
|
|
public function run()
|
|
|
|
{
|
|
|
|
$geoSvc = app(GeoService::class);
|
|
|
|
$acarsRepo = app(AcarsRepository::class);
|
|
|
|
|
|
|
|
$pireps = $acarsRepo->getPositions();
|
|
|
|
$positions = $geoSvc->getFeatureForLiveFlights($pireps);
|
|
|
|
|
2018-03-12 07:00:42 +08:00
|
|
|
return view('widgets.live_map', [
|
2018-01-10 02:48:24 +08:00
|
|
|
'config' => $this->config,
|
|
|
|
'pireps' => $pireps,
|
|
|
|
'positions' => $positions,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|