Created
January 2, 2026 06:47
-
-
Save ymaimbo/c75e47b974273eccbe4256d8458abdc5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use Illuminate\Foundation\Application; | |
| use Illuminate\Support\Facades\Route; | |
| use Inertia\Inertia; | |
| use App\Http\Controllers\Admin\AdminGameController; | |
| use App\Http\Controllers\Admin\AdminImportController; | |
| use App\Http\Controllers\Admin\AdminLeagueController; | |
| use App\Http\Controllers\Admin\AdminOfficialController; | |
| use App\Http\Controllers\Admin\AdminPlayerController; | |
| use App\Http\Controllers\Admin\AdminTeamController; | |
| use App\Http\Controllers\Admin\AdminUserController; | |
| use App\Http\Controllers\GameController; | |
| use App\Http\Controllers\LeagueController; | |
| use App\Http\Controllers\CommunityController; | |
| use App\Http\Controllers\PlayerController; | |
| use App\Http\Controllers\ScheduleController; | |
| use App\Http\Controllers\TeamController; | |
| use App\Http\Controllers\TearController; | |
| use App\Http\Controllers\YearSlabController; | |
| /* | |
| |-------------------------------------------------------------------------- | |
| | Landing | |
| |-------------------------------------------------------------------------- | |
| */ | |
| Route::get('/', function () { | |
| return Inertia::render('Welcome', [ | |
| 'canLogin' => Route::has('login'), | |
| 'canRegister' => Route::has('register'), | |
| 'laravelVersion' => Application::VERSION, | |
| 'phpVersion' => PHP_VERSION, | |
| ]); | |
| })->name('welcome'); | |
| /* | |
| |-------------------------------------------------------------------------- | |
| | Authenticated area | |
| |-------------------------------------------------------------------------- | |
| */ | |
| Route::middleware([ | |
| 'auth:sanctum', | |
| config('jetstream.auth_session'), | |
| 'verified', | |
| ])->group(function () { | |
| Route::get('/dashboard', function () { | |
| return Inertia::render('Dashboard'); | |
| })->name('dashboard'); | |
| /* | |
| |-------------------------------------------------------------------------- | |
| | Admin area | |
| |-------------------------------------------------------------------------- | |
| */ | |
| Route::prefix('admin')->as('admin.')->group(function () { | |
| /* | |
| |-------------------------------------------------------------------------- | |
| | Admin Games / Fixtures | |
| |-------------------------------------------------------------------------- | |
| | Allow both roles into the games admin area. | |
| | Per-league restrictions are enforced in GamePolicy + controller authorize(). | |
| */ | |
| Route::middleware(['role:super-admin|league-admin'])->group(function () { | |
| // Index + bulk actions | |
| Route::get('games', [AdminGameController::class, 'index']) | |
| ->name('games.index'); | |
| Route::post('games/bulk', [AdminGameController::class, 'bulkUpdate']) | |
| ->name('games.bulk.update'); | |
| // Create + Store (POST /admin/games) | |
| Route::get('games/create', [AdminGameController::class, 'create']) | |
| ->name('games.create'); | |
| Route::post('games', [AdminGameController::class, 'store']) | |
| ->name('games.store'); | |
| // Clone | |
| Route::get('games/{game}/clone', [AdminGameController::class, 'clone']) | |
| ->middleware('can:update,game') | |
| ->name('games.clone'); | |
| // Roster | |
| Route::get('games/{game}/roster', [AdminGameController::class, 'roster']) | |
| ->middleware('can:update,game') | |
| ->name('games.roster'); | |
| Route::post('games/{game}/roster', [AdminGameController::class, 'updateRoster']) | |
| ->middleware('can:update,game') | |
| ->name('games.roster.update'); | |
| // Box score editor | |
| Route::get('games/{game}/edit', [AdminGameController::class, 'edit']) | |
| ->middleware('can:update,game') | |
| ->name('games.edit'); | |
| Route::put('games/{game}', [AdminGameController::class, 'update']) | |
| ->middleware('can:update,game') | |
| ->name('games.update'); | |
| }); | |
| /* | |
| |-------------------------------------------------------------------------- | |
| | Other admin sections (keep as you had) | |
| |-------------------------------------------------------------------------- | |
| */ | |
| Route::resource('teams', AdminTeamController::class)->except(['show']); | |
| Route::resource('leagues', AdminLeagueController::class)->except(['show']); | |
| Route::post('leagues/{league}/archive', [AdminLeagueController::class, 'archive']) | |
| ->name('leagues.archive'); | |
| Route::resource('players', AdminPlayerController::class)->except(['show']); | |
| Route::resource('officials', AdminOfficialController::class)->except(['show']); | |
| Route::resource('users', AdminUserController::class) | |
| ->only(['index', 'edit', 'update']); | |
| Route::get('import', [AdminImportController::class, 'index'])->name('import.index'); | |
| Route::post('import', [AdminImportController::class, 'store'])->name('import.store'); | |
| }); | |
| }); | |
| /* | |
| |-------------------------------------------------------------------------- | |
| | Public pages (named for Ziggy) | |
| |-------------------------------------------------------------------------- | |
| */ | |
| Route::get('/leagues', [LeagueController::class, 'index'])->name('leagues.index'); | |
| Route::get('/leagues/{league:slug}', [LeagueController::class, 'show'])->name('leagues.show'); | |
| Route::get('/leagues/{league:slug}/schedule', [ScheduleController::class, 'index']) | |
| ->name('leagues.schedule'); | |
| Route::get('/teams', [TeamController::class, 'index'])->name('teams.index'); | |
| Route::get('/teams/{team:slug}', [TeamController::class, 'show'])->name('teams.show'); | |
| Route::get('/players', [PlayerController::class, 'index'])->name('players.index'); | |
| Route::get('/players/{player:slug}', [PlayerController::class, 'show'])->name('players.show'); | |
| Route::get('/games/live', [GameController::class, 'live'])->name('games.live'); | |
| Route::get('/games/{game}', [GameController::class, 'show'])->name('games.show'); | |
| Route::get('/schedules/{league:slug}/schedule', [ScheduleController::class, 'index'])->name('schedules.index'); | |
| Route::get('/yearslabs', [YearSlabController::class, 'index'])->name('yearslabs.index'); | |
| Route::get('/tears', [TearController::class, 'index'])->name('tears.index'); | |
| Route::get('/tears/{tear:slug}', [TearController::class, 'show'])->name('tears.show'); | |
| Route::get('/partners', function () { | |
| return Inertia::render('Partners/Index'); | |
| })->name('partners.index'); | |
| Route::get('/community', [CommunityController::class, 'index'])->name('community.index'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment