Add missing expiry time for PIREP API (#356)
This commit is contained in:
parent
39fbdcb787
commit
c1103afe8f
@ -7,6 +7,7 @@ use App\Models\Acars;
|
|||||||
use App\Models\Airline;
|
use App\Models\Airline;
|
||||||
use App\Models\Pirep;
|
use App\Models\Pirep;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use App\Repositories\AcarsRepository;
|
||||||
use App\Services\AirportService;
|
use App\Services\AirportService;
|
||||||
use App\Services\AwardService;
|
use App\Services\AwardService;
|
||||||
use App\Services\DatabaseService;
|
use App\Services\DatabaseService;
|
||||||
@ -55,6 +56,7 @@ class DevCommands extends Command
|
|||||||
'compile-assets' => 'compileAssets',
|
'compile-assets' => 'compileAssets',
|
||||||
'db-attrs' => 'dbAttrs',
|
'db-attrs' => 'dbAttrs',
|
||||||
'list-awards' => 'listAwardClasses',
|
'list-awards' => 'listAwardClasses',
|
||||||
|
'live-flights' => 'liveFlights',
|
||||||
'manual-insert' => 'manualInsert',
|
'manual-insert' => 'manualInsert',
|
||||||
'metar' => 'getMetar',
|
'metar' => 'getMetar',
|
||||||
'reset-install' => 'resetInstall',
|
'reset-install' => 'resetInstall',
|
||||||
@ -278,4 +280,12 @@ class DevCommands extends Command
|
|||||||
|
|
||||||
$this->info('Done!');
|
$this->info('Done!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function liveFlights(): void
|
||||||
|
{
|
||||||
|
$acarsRepo = app(AcarsRepository::class);
|
||||||
|
$flights = $acarsRepo->getPositions(setting('acars.live_time'))->toArray();
|
||||||
|
|
||||||
|
dd($flights);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,17 +166,13 @@ class PirepController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$active = [];
|
$pireps = $this->acarsRepo
|
||||||
$pireps = $this->acarsRepo->getPositions();
|
->getPositions(setting('acars.live_time'))
|
||||||
foreach ($pireps as $pirep) {
|
->filter(function ($pirep) {
|
||||||
if (!$pirep->position) {
|
return $pirep->position !== null;
|
||||||
continue;
|
});
|
||||||
}
|
|
||||||
|
|
||||||
$active[] = $pirep;
|
return PirepResource::collection($pireps);
|
||||||
}
|
|
||||||
|
|
||||||
return PirepResource::collection(collect($active));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user