phpvms/app/Http/Controllers/Frontend/AcarsController.php

48 lines
1.0 KiB
PHP
Raw Normal View History

<?php
namespace App\Http\Controllers\Frontend;
use App\Contracts\Controller;
use App\Repositories\AcarsRepository;
use App\Services\GeoService;
use Illuminate\Http\Request;
/**
* Class AcarsController
*/
class AcarsController extends Controller
{
2018-08-27 00:40:04 +08:00
private $acarsRepo;
private $geoSvc;
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
* @param GeoService $geoSvc
2018-02-21 12:33:09 +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
*/
public function index(Request $request)
{
$pireps = $this->acarsRepo->getPositions();
$positions = $this->geoSvc->getFeatureForLiveFlights($pireps);
return view('acars.index', [
'pireps' => $pireps,
'positions' => $positions,
]);
}
}