99
1010use App \Http \Controllers \Controller ;
1111use App \Jobs \Notifications \TeamApplicationReject ;
12+ use App \Jobs \Notifications \TeamApplicationStore ;
1213use App \Models \Team ;
1314use App \Models \TeamApplication ;
1415use Symfony \Component \HttpFoundation \Response ;
@@ -39,7 +40,7 @@ public function accept(string $teamId, string $id): Response
3940 public function destroy (string $ teamId , string $ id ): Response
4041 {
4142 $ currentUser = \Auth::user ();
42- TeamApplication::where ('team_id ' , $ teamId )->findOrFail ($ currentUser ->getKey ())->delete ();
43+ TeamApplication::where ('team_id ' , $ teamId )->findOrFail ($ currentUser ->getKey ())->cancel ();
4344
4445 \Session::flash ('popup ' , osu_trans ('teams.applications.destroy.ok ' ));
4546
@@ -65,7 +66,9 @@ public function store(string $teamId): Response
6566 $ team = Team::findOrFail ($ teamId );
6667 priv_check ('TeamApplicationStore ' , $ team )->ensureCan ();
6768
68- $ team ->applications ()->createOrFirst (['user_id ' => \Auth::id ()]);
69+ $ user = \Auth::user ();
70+ $ application = $ team ->applications ()->createOrFirst (['user_id ' => $ user ->getKey ()]);
71+ (new TeamApplicationStore ($ application , $ user ))->dispatch ();
6972 \Session::flash ('popup ' , osu_trans ('teams.applications.store.ok ' ));
7073
7174 return response (null , 204 );
0 commit comments