parent
39159e2c2e
commit
f392bf1cb8
15
app/Events/PirepCancelled.php
Normal file
15
app/Events/PirepCancelled.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use App\Models\Pirep;
|
||||
|
||||
class PirepCancelled extends BaseEvent
|
||||
{
|
||||
public $pirep;
|
||||
|
||||
public function __construct(Pirep $pirep)
|
||||
{
|
||||
$this->pirep = $pirep;
|
||||
}
|
||||
}
|
15
app/Events/PirepPrefiled.php
Normal file
15
app/Events/PirepPrefiled.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use App\Models\Pirep;
|
||||
|
||||
class PirepPrefiled extends BaseEvent
|
||||
{
|
||||
public $pirep;
|
||||
|
||||
public function __construct(Pirep $pirep)
|
||||
{
|
||||
$this->pirep = $pirep;
|
||||
}
|
||||
}
|
15
app/Events/PirepUpdated.php
Normal file
15
app/Events/PirepUpdated.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use App\Models\Pirep;
|
||||
|
||||
class PirepUpdated extends BaseEvent
|
||||
{
|
||||
public $pirep;
|
||||
|
||||
public function __construct(Pirep $pirep)
|
||||
{
|
||||
$this->pirep = $pirep;
|
||||
}
|
||||
}
|
@ -3,6 +3,8 @@
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Contracts\Controller;
|
||||
use App\Events\PirepPrefiled;
|
||||
use App\Events\PirepUpdated;
|
||||
use App\Exceptions\AircraftNotAtAirport;
|
||||
use App\Exceptions\AircraftPermissionDenied;
|
||||
use App\Exceptions\PirepCancelled;
|
||||
@ -247,6 +249,8 @@ class PirepController extends Controller
|
||||
$this->updateFields($pirep, $request);
|
||||
$this->updateFares($pirep, $request);
|
||||
|
||||
event(new PirepPrefiled($pirep));
|
||||
|
||||
return new PirepResource($pirep);
|
||||
}
|
||||
|
||||
@ -291,6 +295,8 @@ class PirepController extends Controller
|
||||
$this->updateFields($pirep, $request);
|
||||
$this->updateFares($pirep, $request);
|
||||
|
||||
event(new PirepUpdated($pirep));
|
||||
|
||||
return new PirepResource($pirep);
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ namespace App\Services;
|
||||
|
||||
use App\Contracts\Service;
|
||||
use App\Events\PirepAccepted;
|
||||
use App\Events\PirepCancelled;
|
||||
use App\Events\PirepFiled;
|
||||
use App\Events\PirepRejected;
|
||||
use App\Events\UserStatsChanged;
|
||||
@ -255,6 +256,8 @@ class PirepService extends Service
|
||||
'status' => PirepStatus::CANCELLED,
|
||||
], $pirep->id);
|
||||
|
||||
event(new PirepCancelled($pirep));
|
||||
|
||||
return $pirep;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user