Convert live acars map into a widget

This commit is contained in:
Nabeel Shahzad
2018-01-09 12:48:24 -06:00
parent 458ee93974
commit 26d3a7f4d6
6 changed files with 74 additions and 41 deletions

View File

@@ -2,7 +2,6 @@
namespace App\Http\Controllers\Frontend;
use App\Models\Pirep;
use App\Repositories\AcarsRepository;
use App\Services\GeoService;
use Illuminate\Http\Request;

32
app/Widgets/LiveMap.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
namespace App\Widgets;
use App\Repositories\AcarsRepository;
use App\Services\GeoService;
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,
]);
}
}