2017-12-28 06:47:22 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Frontend;
|
|
|
|
|
2019-07-16 03:44:31 +08:00
|
|
|
use App\Contracts\Controller;
|
2017-12-28 06:47:22 +08:00
|
|
|
use App\Repositories\AcarsRepository;
|
|
|
|
use App\Services\GeoService;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
2019-08-06 01:07:22 +08:00
|
|
|
class LiveMapController extends Controller
|
2017-12-28 06:47:22 +08:00
|
|
|
{
|
2018-08-27 00:40:04 +08:00
|
|
|
private $acarsRepo;
|
|
|
|
private $geoSvc;
|
2017-12-28 06:47:22 +08:00
|
|
|
|
2018-02-21 12:33:09 +08:00
|
|
|
/**
|
|
|
|
* AcarsController constructor.
|
2018-08-27 00:40:04 +08:00
|
|
|
*
|
2018-02-21 12:33:09 +08:00
|
|
|
* @param AcarsRepository $acarsRepo
|
2018-03-20 09:50:40 +08:00
|
|
|
* @param GeoService $geoSvc
|
2018-02-21 12:33:09 +08:00
|
|
|
*/
|
2017-12-28 06:47:22 +08:00
|
|
|
public function __construct(
|
|
|
|
AcarsRepository $acarsRepo,
|
|
|
|
GeoService $geoSvc
|
|
|
|
) {
|
|
|
|
$this->acarsRepo = $acarsRepo;
|
|
|
|
$this->geoSvc = $geoSvc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-02-21 12:33:09 +08:00
|
|
|
* @param Request $request
|
2018-08-27 00:40:04 +08:00
|
|
|
*
|
2018-02-21 12:33:09 +08:00
|
|
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
2017-12-28 06:47:22 +08:00
|
|
|
*/
|
|
|
|
public function index(Request $request)
|
|
|
|
{
|
|
|
|
$pireps = $this->acarsRepo->getPositions();
|
|
|
|
$positions = $this->geoSvc->getFeatureForLiveFlights($pireps);
|
|
|
|
|
2019-08-06 01:07:22 +08:00
|
|
|
return view('livemap.index', [
|
2018-03-20 09:50:40 +08:00
|
|
|
'pireps' => $pireps,
|
2017-12-28 06:47:22 +08:00
|
|
|
'positions' => $positions,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|