hide all cancelled pireps #180
This commit is contained in:
parent
3ded06390c
commit
8acb9291fe
@ -136,13 +136,13 @@ class CreateSettingsTable extends Migration
|
||||
'description' => 'The time in minutes to check for a duplicate PIREP',
|
||||
]);
|
||||
|
||||
$this->addSetting('pireps.hide_cancelled_pireps', [
|
||||
/*$this->addSetting('pireps.hide_cancelled_pireps', [
|
||||
'name' => 'Hide Cancelled PIREPs',
|
||||
'group' => 'pireps',
|
||||
'value' => true,
|
||||
'type' => 'boolean',
|
||||
'description' => 'Hide any cancelled PIREPs in the front-end',
|
||||
]);
|
||||
]);*/
|
||||
|
||||
$this->addSetting('pireps.restrict_aircraft_to_rank', [
|
||||
'name' => 'Restrict Aircraft to Ranks',
|
||||
|
@ -94,10 +94,7 @@ class PirepController extends Controller
|
||||
$user = Auth::user();
|
||||
|
||||
$where = [['user_id', $user->id]];
|
||||
|
||||
if(setting('pireps.hide_cancelled_pireps')) {
|
||||
$where[] = ['state', '<>', PirepState::CANCELLED];
|
||||
}
|
||||
$where[] = ['state', '<>', PirepState::CANCELLED];
|
||||
|
||||
$this->pirepRepo->pushCriteria(new WhereCriteria($request, $where));
|
||||
$pireps = $this->pirepRepo->orderBy('created_at', 'desc')->paginate();
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Enums\PirepState;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Laratrust\Traits\LaratrustUserTrait;
|
||||
@ -159,7 +160,8 @@ class User extends Authenticatable
|
||||
|
||||
public function pireps()
|
||||
{
|
||||
return $this->hasMany(Pirep::class, 'user_id');
|
||||
return $this->hasMany(Pirep::class, 'user_id')
|
||||
->where('state', '!=', PirepState::CANCELLED);
|
||||
}
|
||||
|
||||
public function rank()
|
||||
|
Loading…
Reference in New Issue
Block a user