Ensure simbrief id is assigned
This commit is contained in:
@@ -94,7 +94,7 @@ class FlightRepository extends Repository implements CacheableInterface
|
|||||||
$where['flight_number'] = $request->input('flight_number');
|
$where['flight_number'] = $request->input('flight_number');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->filled('flight_type')) {
|
if ($request->filled('flight_type') && $request->input('flight_type') !== '0') {
|
||||||
$where['flight_type'] = $request->input('flight_type');
|
$where['flight_type'] = $request->input('flight_type');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ use App\Models\Enums\PirepStatus;
|
|||||||
use App\Models\Navdata;
|
use App\Models\Navdata;
|
||||||
use App\Models\Pirep;
|
use App\Models\Pirep;
|
||||||
use App\Models\PirepFieldValue;
|
use App\Models\PirepFieldValue;
|
||||||
|
use App\Models\SimBrief;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Repositories\AircraftRepository;
|
use App\Repositories\AircraftRepository;
|
||||||
use App\Repositories\AirportRepository;
|
use App\Repositories\AirportRepository;
|
||||||
@@ -40,17 +41,16 @@ class PirepService extends Service
|
|||||||
private $airportSvc;
|
private $airportSvc;
|
||||||
private $geoSvc;
|
private $geoSvc;
|
||||||
private $pirepRepo;
|
private $pirepRepo;
|
||||||
|
private $simbriefSvc;
|
||||||
private $userSvc;
|
private $userSvc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param AircraftRepository $aircraftRepo
|
* @param AircraftRepository $aircraftRepo
|
||||||
* @param GeoService $geoSvc
|
* @param GeoService $geoSvc
|
||||||
* @param PirepRepository $pirepRepo
|
|
||||||
* @param UserService $userSvc
|
|
||||||
* @param AirportRepository $airportRepo
|
* @param AirportRepository $airportRepo
|
||||||
* @param AirportService $airportSvc
|
* @param AirportService $airportSvc
|
||||||
* @param GeoService $geoSvc
|
|
||||||
* @param PirepRepository $pirepRepo
|
* @param PirepRepository $pirepRepo
|
||||||
|
* @param SimBriefService $simbriefSvc
|
||||||
* @param UserService $userSvc
|
* @param UserService $userSvc
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
@@ -59,14 +59,16 @@ class PirepService extends Service
|
|||||||
AircraftRepository $aircraftRepo,
|
AircraftRepository $aircraftRepo,
|
||||||
GeoService $geoSvc,
|
GeoService $geoSvc,
|
||||||
PirepRepository $pirepRepo,
|
PirepRepository $pirepRepo,
|
||||||
|
SimBriefService $simbriefSvc,
|
||||||
UserService $userSvc
|
UserService $userSvc
|
||||||
) {
|
) {
|
||||||
$this->airportRepo = $airportRepo;
|
$this->airportRepo = $airportRepo;
|
||||||
$this->airportSvc = $airportSvc;
|
$this->airportSvc = $airportSvc;
|
||||||
$this->aircraftRepo = $aircraftRepo;
|
$this->aircraftRepo = $aircraftRepo;
|
||||||
$this->geoSvc = $geoSvc;
|
$this->geoSvc = $geoSvc;
|
||||||
$this->userSvc = $userSvc;
|
|
||||||
$this->pirepRepo = $pirepRepo;
|
$this->pirepRepo = $pirepRepo;
|
||||||
|
$this->simbriefSvc = $simbriefSvc;
|
||||||
|
$this->userSvc = $userSvc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -149,6 +151,12 @@ class PirepService extends Service
|
|||||||
|
|
||||||
$pirep->save();
|
$pirep->save();
|
||||||
|
|
||||||
|
// Check of there is a simbrief_id
|
||||||
|
if (array_key_exists('simbrief_id', $attrs)) {
|
||||||
|
$simbrief = SimBrief::find($attrs['simbrief_id']);
|
||||||
|
$this->simbriefSvc->attachSimbriefToPirep($pirep, $simbrief);
|
||||||
|
}
|
||||||
|
|
||||||
return $pirep;
|
return $pirep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user