Pilot changed event fixed for new airport
This commit is contained in:
parent
babdca627e
commit
b382ad77eb
@ -17,6 +17,7 @@ class UserStatsChanged
|
||||
|
||||
/*
|
||||
* When a user's stats change. Stats changed match the field name:
|
||||
* airport
|
||||
* flights
|
||||
* rank
|
||||
*/
|
||||
|
@ -198,10 +198,11 @@ class PIREPService extends BaseService
|
||||
$pilot = $pirep->pilot;
|
||||
$pilot->refresh();
|
||||
|
||||
$previous_airport = $pilot->curr_airport_id;
|
||||
$pilot->curr_airport_id = $pirep->arr_airport_id;
|
||||
$pilot->last_pirep_id = $pirep->id;
|
||||
$pilot->save();
|
||||
|
||||
event(new UserStatsChanged($pilot));
|
||||
event(new UserStatsChanged($pilot, 'airport', $previous_airport));
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ class UserService extends BaseService
|
||||
public function changeUserState(User $user, $old_state): User
|
||||
{
|
||||
if($user->state === $old_state) {
|
||||
return;
|
||||
return $user;
|
||||
}
|
||||
|
||||
Log::info('User ' . $user->pilot_id . ' state changing from '
|
||||
|
Loading…
Reference in New Issue
Block a user