39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\Route;
|
|
use app\Helpers\FighterClassification;
|
|
use App\Models\Member;
|
|
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Web Routes
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Here is where you can register web routes for your application. These
|
|
| routes are loaded by the RouteServiceProvider within a group which
|
|
| contains the "web" middleware group. Now create something great!
|
|
|
|
|
*/
|
|
|
|
Route::get('/', function () {
|
|
return view('welcome');
|
|
});
|
|
|
|
|
|
Route::get('/find', function () {
|
|
$fighters = \App\Models\Member::all()->toArray();
|
|
|
|
// Call global function with leading backslash to avoid namespace issue
|
|
$groupedJson = \groupFighters($fighters, 2025);
|
|
|
|
return response($groupedJson, 200)->header('Content-Type', 'application/json');
|
|
});
|
|
|
|
Route::get('/taekwondo-draw', function () {
|
|
$fighters = Member::all()->toArray();
|
|
$draws = groupFightersWithTaekwondoDraw($fighters, 2025); // Change year if you want
|
|
return response()->json($draws, 200);
|
|
});
|
|
|