Add acars map page and show in-progress flights
This commit is contained in:
@@ -3,12 +3,16 @@
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Models\Acars;
|
||||
use App\Models\Pirep;
|
||||
use App\Models\Enums\PirepState;
|
||||
use App\Models\Enums\PirepStatus;
|
||||
|
||||
use App\Repositories\Traits\CacheableRepository;
|
||||
use Prettus\Repository\Contracts\CacheableInterface;
|
||||
|
||||
class AcarsRepository extends BaseRepository implements CacheableInterface
|
||||
class AcarsRepository extends BaseRepository //implements CacheableInterface
|
||||
{
|
||||
use CacheableRepository;
|
||||
//use CacheableRepository;
|
||||
|
||||
public function model()
|
||||
{
|
||||
@@ -19,4 +23,30 @@ class AcarsRepository extends BaseRepository implements CacheableInterface
|
||||
{
|
||||
return $this->findWhere(['pirep_id' => $pirep_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the PIREPS that are in-progress, and then
|
||||
* get the latest update for those flights
|
||||
* @return Pirep
|
||||
*/
|
||||
public function getPositions()
|
||||
{
|
||||
return Pirep::with(['airline', 'position'])
|
||||
->where(['state' => PirepState::IN_PROGRESS])
|
||||
->get();
|
||||
|
||||
/*return Pirep::with(['acars' => function($q) {
|
||||
return $q->limit(1);
|
||||
}])->where(['state' => PirepState::IN_PROGRESS])->get();*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function getAllAcarsPoints()
|
||||
{
|
||||
return Pirep::with('acars')->where([
|
||||
'state' => PirepState::IN_PROGRESS
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user