phpvms/app/Widgets/LiveMap.php

37 lines
792 B
PHP
Raw Normal View History

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);
return $this->view('widgets.live_map', [
'config' => $this->config,
'pireps' => $pireps,
'positions' => $positions,
]);
}
}