Only show flights if they're also marked as visible
This commit is contained in:
@@ -40,7 +40,6 @@ class SetActiveFlights extends Listener
|
|||||||
* @var Flight $flight
|
* @var Flight $flight
|
||||||
*/
|
*/
|
||||||
foreach($flights as $flight) {
|
foreach($flights as $flight) {
|
||||||
|
|
||||||
if (!$flight->active) {
|
if (!$flight->active) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -54,6 +53,9 @@ class SetActiveFlights extends Listener
|
|||||||
Log::info('Marking flight '.$flight->ident.' to '.($visible ? 'visible' : 'invisible'));
|
Log::info('Marking flight '.$flight->ident.' to '.($visible ? 'visible' : 'invisible'));
|
||||||
$flight->visible = $visible;
|
$flight->visible = $visible;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Log::info('Toggling flight '.$flight->ident.' to visible');
|
||||||
|
$flight->visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$flight->save();
|
$flight->save();
|
||||||
@@ -72,7 +74,10 @@ class SetActiveFlights extends Listener
|
|||||||
$flight->visible = true;
|
$flight->visible = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$flight->visible = true;
|
if ($flight->visible !== true) {
|
||||||
|
Log::info('Toggling flight '.$flight->ident.' to visible');
|
||||||
|
$flight->visible = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$flight->visible = false;
|
$flight->visible = false;
|
||||||
|
|||||||
@@ -44,7 +44,11 @@ class FlightController extends Controller
|
|||||||
{
|
{
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
|
|
||||||
$where = ['active' => true];
|
$where = [
|
||||||
|
'active' => true,
|
||||||
|
'visible' => true,
|
||||||
|
];
|
||||||
|
|
||||||
if(setting('pilots.restrict_to_company')) {
|
if(setting('pilots.restrict_to_company')) {
|
||||||
$where['airline_id'] = Auth::user()->airline_id;
|
$where['airline_id'] = Auth::user()->airline_id;
|
||||||
}
|
}
|
||||||
@@ -84,7 +88,11 @@ class FlightController extends Controller
|
|||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$where = ['active' => true];
|
$where = [
|
||||||
|
'active' => true,
|
||||||
|
'visible' => true,
|
||||||
|
];
|
||||||
|
|
||||||
if(setting('pilots.restrict_to_company')) {
|
if(setting('pilots.restrict_to_company')) {
|
||||||
$where['airline_id'] = Auth::user()->airline_id;
|
$where['airline_id'] = Auth::user()->airline_id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,8 +52,10 @@ class FlightController extends Controller
|
|||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
$where = [
|
$where = [
|
||||||
'active' => true,
|
'active' => true,
|
||||||
|
'visible' => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
if(setting('pilots.restrict_to_company')) {
|
if(setting('pilots.restrict_to_company')) {
|
||||||
$where['airline_id'] = Auth::user()->airline_id;
|
$where['airline_id'] = Auth::user()->airline_id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,8 @@ class FlightRepository extends Repository implements CacheableInterface
|
|||||||
$where = [];
|
$where = [];
|
||||||
|
|
||||||
if ($only_active === true) {
|
if ($only_active === true) {
|
||||||
$where['active'] = $only_active;
|
$where['active'] = $only_active;
|
||||||
|
$where['visible'] = $only_active;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->filled('flight_id')) {
|
if ($request->filled('flight_id')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user