+ public function setNickname(Request $request, User $user) {
+ $this->authorize('setNickname', $user);
+
+ $validatedData = $request->validate([
+ 'nickname' => 'string',
+ ]);
+
+ $user->nickname = $validatedData['nickname'];
+ $user->update();
+
+ UserChanged::dispatch($user);
+
+ return $user->toJson();
+ }
+
+ public function setStreamLink(Request $request, User $user) {
+ $this->authorize('setStreamLink', $user);
+
+ $validatedData = $request->validate([
+ 'stream_link' => 'required|url',
+ ]);
+
+ $user->stream_link = $validatedData['stream_link'];
+ $user->update();
+
+ UserChanged::dispatch($user);
+
+ return $user->toJson();
+ }
+
+ public function single(Request $request, $id) {
+ $user = User::findOrFail($id);
+ $this->authorize('view', $user);
+ $user->append('random_quote');
+ $user->load('participation');
+ $user->load('participation.tournament');
+ $user->loadCount('round_first');
+ $user->loadCount('round_second');
+ $user->loadCount('round_third');
+ $user->loadCount('tournament_first');
+ $user->loadCount('tournament_second');
+ $user->loadCount('tournament_third');
+ return $user->toJson();
+ }
+