Laravel 9 Update (#1413)
Update to Laravel 9 and PHP 8+ Co-authored-by: B.Fatih KOZ <fatih.koz@gmail.com>
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Api;
|
||||
use App\Contracts\Controller;
|
||||
use App\Events\AcarsUpdate;
|
||||
use App\Exceptions\PirepCancelled;
|
||||
use App\Exceptions\PirepNotFound;
|
||||
use App\Http\Requests\Acars\EventRequest;
|
||||
use App\Http\Requests\Acars\LogRequest;
|
||||
use App\Http\Requests\Acars\PositionRequest;
|
||||
@@ -12,7 +13,6 @@ use App\Http\Resources\AcarsRoute as AcarsRouteResource;
|
||||
use App\Http\Resources\Pirep as PirepResource;
|
||||
use App\Models\Acars;
|
||||
use App\Models\Enums\AcarsType;
|
||||
use App\Models\Enums\PirepStatus;
|
||||
use App\Models\Pirep;
|
||||
use App\Repositories\AcarsRepository;
|
||||
use App\Repositories\PirepRepository;
|
||||
@@ -20,14 +20,13 @@ use App\Services\GeoService;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class AcarsController extends Controller
|
||||
{
|
||||
private $acarsRepo;
|
||||
private $geoSvc;
|
||||
private $pirepRepo;
|
||||
private AcarsRepository $acarsRepo;
|
||||
private GeoService $geoSvc;
|
||||
private PirepRepository $pirepRepo;
|
||||
|
||||
/**
|
||||
* AcarsController constructor.
|
||||
@@ -67,9 +66,11 @@ class AcarsController extends Controller
|
||||
*/
|
||||
public function live_flights()
|
||||
{
|
||||
$pireps = $this->acarsRepo->getPositions(setting('acars.live_time'))->filter(function ($pirep) {
|
||||
return $pirep->position !== null;
|
||||
});
|
||||
$pireps = $this->acarsRepo->getPositions(setting('acars.live_time'))->filter(
|
||||
function ($pirep) {
|
||||
return $pirep->position !== null;
|
||||
}
|
||||
);
|
||||
|
||||
return PirepResource::collection($pireps);
|
||||
}
|
||||
@@ -102,6 +103,10 @@ class AcarsController extends Controller
|
||||
public function acars_geojson($pirep_id, Request $request)
|
||||
{
|
||||
$pirep = Pirep::find($pirep_id);
|
||||
if (empty($pirep)) {
|
||||
throw new PirepNotFound($pirep_id);
|
||||
}
|
||||
|
||||
$geodata = $this->geoSvc->getFeatureFromAcars($pirep);
|
||||
|
||||
return response()->json([
|
||||
@@ -119,7 +124,11 @@ class AcarsController extends Controller
|
||||
*/
|
||||
public function acars_get($id, Request $request)
|
||||
{
|
||||
$this->pirepRepo->find($id);
|
||||
$pirep = $this->pirepRepo->find($id);
|
||||
if (empty($pirep)) {
|
||||
throw new PirepNotFound($id);
|
||||
}
|
||||
|
||||
$acars = Acars::with(['pirep'])
|
||||
->where([
|
||||
'pirep_id' => $id,
|
||||
@@ -137,8 +146,8 @@ class AcarsController extends Controller
|
||||
* @param $id
|
||||
* @param PositionRequest $request
|
||||
*
|
||||
* @throws \App\Exceptions\PirepCancelled
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
|
||||
* @throws \App\Exceptions\PirepCancelled
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
@@ -146,6 +155,10 @@ class AcarsController extends Controller
|
||||
{
|
||||
// Check if the status is cancelled...
|
||||
$pirep = Pirep::find($id);
|
||||
if (empty($pirep)) {
|
||||
throw new PirepNotFound($id);
|
||||
}
|
||||
|
||||
$this->checkCancelled($pirep);
|
||||
|
||||
/*Log::debug(
|
||||
@@ -212,8 +225,8 @@ class AcarsController extends Controller
|
||||
* @param $id
|
||||
* @param LogRequest $request
|
||||
*
|
||||
* @throws \App\Exceptions\PirepCancelled
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
|
||||
* @throws \App\Exceptions\PirepCancelled
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
@@ -221,6 +234,10 @@ class AcarsController extends Controller
|
||||
{
|
||||
// Check if the status is cancelled...
|
||||
$pirep = Pirep::find($id);
|
||||
if (empty($pirep)) {
|
||||
throw new PirepNotFound($id);
|
||||
}
|
||||
|
||||
$this->checkCancelled($pirep);
|
||||
|
||||
// Log::debug('Posting ACARS log, PIREP: '.$id, $request->post());
|
||||
@@ -266,8 +283,8 @@ class AcarsController extends Controller
|
||||
* @param $id
|
||||
* @param EventRequest $request
|
||||
*
|
||||
* @throws \App\Exceptions\PirepCancelled
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
|
||||
* @throws \App\Exceptions\PirepCancelled
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
@@ -275,6 +292,10 @@ class AcarsController extends Controller
|
||||
{
|
||||
// Check if the status is cancelled...
|
||||
$pirep = Pirep::find($id);
|
||||
if (empty($pirep)) {
|
||||
throw new PirepNotFound($id);
|
||||
}
|
||||
|
||||
$this->checkCancelled($pirep);
|
||||
|
||||
Log::debug('Posting ACARS event, PIREP: '.$id, $request->post());
|
||||
|
||||
@@ -9,7 +9,7 @@ use Illuminate\Http\Request;
|
||||
|
||||
class AirlineController extends Controller
|
||||
{
|
||||
private $airlineRepo;
|
||||
private AirlineRepository $airlineRepo;
|
||||
|
||||
/**
|
||||
* AirlineController constructor.
|
||||
|
||||
@@ -15,8 +15,8 @@ use Prettus\Repository\Criteria\RequestCriteria;
|
||||
*/
|
||||
class AirportController extends Controller
|
||||
{
|
||||
private $airportRepo;
|
||||
private $airportSvc;
|
||||
private AirportRepository $airportRepo;
|
||||
private AirportService $airportSvc;
|
||||
|
||||
/**
|
||||
* AirportController constructor.
|
||||
|
||||
@@ -20,14 +20,9 @@ use Prettus\Repository\Exceptions\RepositoryException;
|
||||
|
||||
class FlightController extends Controller
|
||||
{
|
||||
/** @var \App\Services\FareService */
|
||||
private $fareSvc;
|
||||
|
||||
/** @var \App\Repositories\FlightRepository */
|
||||
private $flightRepo;
|
||||
|
||||
/** @var \App\Services\FlightService */
|
||||
private $flightSvc;
|
||||
private FareService $fareSvc;
|
||||
private FlightRepository $flightRepo;
|
||||
private FlightService $flightSvc;
|
||||
|
||||
/**
|
||||
* @param FareService $fareSvc
|
||||
|
||||
@@ -9,7 +9,7 @@ use Illuminate\Http\Request;
|
||||
|
||||
class NewsController extends Controller
|
||||
{
|
||||
private $newsRepo;
|
||||
private NewsRepository $newsRepo;
|
||||
|
||||
/**
|
||||
* AirlineController constructor.
|
||||
|
||||
@@ -38,11 +38,11 @@ use Illuminate\Support\Facades\Log;
|
||||
|
||||
class PirepController extends Controller
|
||||
{
|
||||
private $financeSvc;
|
||||
private $journalRepo;
|
||||
private $pirepRepo;
|
||||
private $pirepSvc;
|
||||
private $userSvc;
|
||||
private PirepFinanceService $financeSvc;
|
||||
private JournalRepository $journalRepo;
|
||||
private PirepRepository $pirepRepo;
|
||||
private PirepService $pirepSvc;
|
||||
private UserService $userSvc;
|
||||
|
||||
/**
|
||||
* @param PirepFinanceService $financeSvc
|
||||
|
||||
@@ -12,7 +12,7 @@ use Illuminate\Http\Request;
|
||||
*/
|
||||
class SettingsController extends Controller
|
||||
{
|
||||
private $settingRepo;
|
||||
private SettingRepository $settingRepo;
|
||||
|
||||
/**
|
||||
* SettingsController constructor.
|
||||
|
||||
@@ -3,20 +3,27 @@
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Contracts\Controller;
|
||||
use PragmaRX\Version\Package\Facade as Version;
|
||||
use App\Services\VersionService;
|
||||
|
||||
/**
|
||||
* Class StatusController
|
||||
*/
|
||||
class StatusController extends Controller
|
||||
{
|
||||
private VersionService $versionSvc;
|
||||
|
||||
public function __construct(VersionService $versionSvc)
|
||||
{
|
||||
$this->versionSvc = $versionSvc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function status()
|
||||
{
|
||||
return response()->json([
|
||||
'version' => Version::compact(),
|
||||
'version' => $this->versionSvc->getCurrentVersion(true),
|
||||
'php' => PHP_VERSION,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ use App\Repositories\FlightRepository;
|
||||
use App\Repositories\PirepRepository;
|
||||
use App\Repositories\UserRepository;
|
||||
use App\Services\BidService;
|
||||
use App\Services\FlightService;
|
||||
use App\Services\UserService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
@@ -26,17 +25,15 @@ use Prettus\Repository\Exceptions\RepositoryException;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
private $bidSvc;
|
||||
private $flightRepo;
|
||||
private $flightSvc;
|
||||
private $pirepRepo;
|
||||
private $userRepo;
|
||||
private $userSvc;
|
||||
private BidService $bidSvc;
|
||||
private FlightRepository $flightRepo;
|
||||
private PirepRepository $pirepRepo;
|
||||
private UserRepository $userRepo;
|
||||
private UserService $userSvc;
|
||||
|
||||
/**
|
||||
* @param BidService $bidSvc
|
||||
* @param FlightRepository $flightRepo
|
||||
* @param FlightService $flightSvc
|
||||
* @param PirepRepository $pirepRepo
|
||||
* @param UserRepository $userRepo
|
||||
* @param UserService $userSvc
|
||||
@@ -44,14 +41,12 @@ class UserController extends Controller
|
||||
public function __construct(
|
||||
BidService $bidSvc,
|
||||
FlightRepository $flightRepo,
|
||||
FlightService $flightSvc,
|
||||
PirepRepository $pirepRepo,
|
||||
UserRepository $userRepo,
|
||||
UserService $userSvc
|
||||
) {
|
||||
$this->bidSvc = $bidSvc;
|
||||
$this->flightRepo = $flightRepo;
|
||||
$this->flightSvc = $flightSvc;
|
||||
$this->pirepRepo = $pirepRepo;
|
||||
$this->userRepo = $userRepo;
|
||||
$this->userSvc = $userSvc;
|
||||
|
||||
Reference in New Issue
Block a user