Live notifications if a user gets leveled up

This question is about how to implement a live notification if the user gets leveled up. My leveling system consists of 100 levels, so every time a user levels up, a notification will pop up into their profile.

while($  user->curr_exp >= $  user->exp_needed){                             if($  user->level <= 19){                             $  user->curr_exp -= $  user->exp_needed;                                $  user->prev_exp = $  user->exp_needed;                             $  user->exp_needed = $  user->prev_exp * 1.4;                             $  user->level += 1;                             $  user->save();                             }                             elseif($  user->level >= 20 && $  user->level <= 39){                                 $  user->curr_exp -= $  user->exp_needed;                                    $  user->prev_exp = $  user->exp_needed;                                 $  user->exp_needed = $  user->prev_exp * 1.1;                                 $  user->level += 1;                                 $  user->save();                             }                             elseif($  user->level >= 40 && $  user->level <= 59){                                 $  user->curr_exp -= $  user->exp_needed;                                    $  user->prev_exp = $  user->exp_needed;                                 $  user->exp_needed = $  user->prev_exp * 1.05;                                 $  user->level += 1;                                 $  user->save();                             }                             elseif($  user->level >= 60 && $  user->level <= 79){                                 $  user->curr_exp -= $  user->exp_needed;                                    $  user->prev_exp = $  user->exp_needed;                                 $  user->exp_needed = $  user->prev_exp * 1.04;                                 $  user->level += 1;                                 $  user->save();                             }                             elseif($  user->level >= 80 && $  user->level <= 99){                                 $  user->curr_exp -= $  user->exp_needed;                                    $  user->prev_exp = $  user->exp_needed;                                 $  user->exp_needed = $  user->prev_exp * 1.03;                                 $  user->level += 1;                                 $  user->save();                             }                             elseif($  user->level == 100){                                 $  user->curr_exp = $  user->curr_exp * 0;                                 $  user->prev_exp -= $  user->exp_needed;                                 $  user->exp_needed = $  user->exp_needed * 0;                                 $  user->level += 0;                                 $  user->save();                             }                             return ['success' => 'Level up!'];                         }  

Any Ideas how to work on this matter? Should I case every levels message? Or is there a simple way to do this. Thanks.