Don't allow cancels from certain states (#396)

* Don't allow cancels from certain states

* Unused imports

* Don't reset the state doubly

* Move SetUserActive into listener; code cleanup

* Unused imports

* Add missing files into htaccess

* Move Command contract to correct folder
This commit is contained in:
Nabeel S
2019-09-16 13:08:26 -04:00
committed by GitHub
parent 41baefbf4a
commit aedb1f22b6
61 changed files with 231 additions and 138 deletions

View File

@@ -42,6 +42,7 @@ use Illuminate\Support\Collection;
* @property Collection fields
* @property int status
* @property bool state
* @property string source
* @property Carbon submitted_at
* @property Carbon created_at
* @property Carbon updated_at
@@ -130,7 +131,7 @@ class Pirep extends Model
'route' => 'nullable',
];
/**
/*
* If a PIREP is in these states, then it can't be changed.
*/
public static $read_only_states = [
@@ -139,6 +140,16 @@ class Pirep extends Model
PirepState::CANCELLED,
];
/*
* If a PIREP is in one of these states, it can't be cancelled
*/
public static $cancel_states = [
PirepState::ACCEPTED,
PirepState::REJECTED,
PirepState::CANCELLED,
PirepState::DELETED,
];
/**
* Get the flight ident, e.,g JBU1900
*