Don't show in progress PIREPs in admin and order the map data
This commit is contained in:
@@ -8,6 +8,7 @@ use App\Http\Requests\UpdatePirepRequest;
|
|||||||
use App\Interfaces\Controller;
|
use App\Interfaces\Controller;
|
||||||
use App\Models\Enums\PirepSource;
|
use App\Models\Enums\PirepSource;
|
||||||
use App\Models\Enums\PirepState;
|
use App\Models\Enums\PirepState;
|
||||||
|
use App\Models\Enums\PirepStatus;
|
||||||
use App\Models\Pirep;
|
use App\Models\Pirep;
|
||||||
use App\Models\PirepComment;
|
use App\Models\PirepComment;
|
||||||
use App\Repositories\AircraftRepository;
|
use App\Repositories\AircraftRepository;
|
||||||
@@ -190,7 +191,11 @@ class PirepController extends Controller
|
|||||||
$this->pirepRepo->pushCriteria($criterea);
|
$this->pirepRepo->pushCriteria($criterea);
|
||||||
|
|
||||||
$pireps = $this->pirepRepo
|
$pireps = $this->pirepRepo
|
||||||
->whereNotInOrder('status', [PirepState::CANCELLED, PirepState::DRAFT], 'created_at', 'desc')
|
->whereNotInOrder('status', [
|
||||||
|
PirepState::CANCELLED,
|
||||||
|
PirepState::DRAFT,
|
||||||
|
PirepState::IN_PROGRESS
|
||||||
|
], 'created_at', 'desc')
|
||||||
->paginate();
|
->paginate();
|
||||||
|
|
||||||
return view('admin.pireps.index', [
|
return view('admin.pireps.index', [
|
||||||
|
|||||||
@@ -240,7 +240,8 @@ class Pirep extends Model
|
|||||||
*/
|
*/
|
||||||
public function getReadOnlyAttribute(): bool
|
public function getReadOnlyAttribute(): bool
|
||||||
{
|
{
|
||||||
return $this->state !== PirepState::PENDING;
|
return $this->state !== PirepState::PENDING
|
||||||
|
&& $this->state != PirepState::IN_PROGRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ class AcarsRepository extends Repository
|
|||||||
{
|
{
|
||||||
return Pirep::with(['airline', 'position', 'aircraft'])
|
return Pirep::with(['airline', 'position', 'aircraft'])
|
||||||
->where(['state' => PirepState::IN_PROGRESS])
|
->where(['state' => PirepState::IN_PROGRESS])
|
||||||
|
->orderBy('created_at', 'desc')
|
||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user