]> git.localhorst.tv Git - alttp.git/blobdiff - app/Http/Controllers/ProtocolController.php
limits for huge tournaments
[alttp.git] / app / Http / Controllers / ProtocolController.php
index c7e3bd2051feb4aef6d179f7878d71bb077402b9..6b5e48cbe4eb8fdd78c6961aec1fdd5bd6d710fe 100644 (file)
@@ -2,9 +2,21 @@
 
 namespace App\Http\Controllers;
 
+use App\Models\Tournament;
 use Illuminate\Http\Request;
 
 class ProtocolController extends Controller
 {
-       //
+
+       public function forTournament(Tournament $tournament) {
+               $this->authorize('viewProtocol', $tournament);
+               $protocol = $tournament
+                       ->protocols()
+                       ->with('user')
+                       ->orderBy('created_at', 'desc')
+                       ->limit(150)
+                       ->get();
+               return $protocol->values()->toJson();
+       }
+
 }