Filter out cancelled PIREPs
This commit is contained in:
parent
8744a8b17b
commit
162057f940
@ -104,6 +104,16 @@ class CreateSettingsTable extends Migration
|
||||
'type' => 'int',
|
||||
'description' => 'The time in minutes to check for a duplicate PIREP',
|
||||
],
|
||||
[
|
||||
'id' => $this->formatSettingId('pireps.hide_cancelled_pireps'),
|
||||
'order' => $this->getNextOrderNumber('pireps'),
|
||||
'name' => 'Hide Cancelled PIREPs',
|
||||
'group' => 'pireps',
|
||||
'value' => true,
|
||||
'default' => true,
|
||||
'type' => 'boolean',
|
||||
'description' => 'Hide any cancelled PIREPs in the front-end',
|
||||
],
|
||||
[
|
||||
'id' => $this->formatSettingId('pilots.id_length'),
|
||||
'order' => $this->getNextOrderNumber('pilots'),
|
||||
|
@ -4,6 +4,7 @@ namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Facades\Utils;
|
||||
use App\Models\Enums\PirepSource;
|
||||
use App\Models\Enums\PirepState;
|
||||
use App\Repositories\Criteria\WhereCriteria;
|
||||
use App\Services\GeoService;
|
||||
use App\Services\PIREPService;
|
||||
@ -54,7 +55,12 @@ class PirepController extends Controller
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
$where = ['user_id' => $user->id];
|
||||
$where = [['user_id', $user->id]];
|
||||
|
||||
if(setting('pireps.hide_cancelled_pireps')) {
|
||||
$where[] = ['state', '<>', PirepState::CANCELLED];
|
||||
}
|
||||
|
||||
$this->pirepRepo->pushCriteria(new WhereCriteria($request, $where));
|
||||
$pireps = $this->pirepRepo->orderBy('created_at', 'desc')->paginate();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user