first commit
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\Auth\AuthenticatedSessionController;
|
||||
use App\Http\Controllers\Auth\ConfirmablePasswordController;
|
||||
use App\Http\Controllers\Auth\EmailVerificationNotificationController;
|
||||
use App\Http\Controllers\Auth\EmailVerificationPromptController;
|
||||
use App\Http\Controllers\Auth\NewPasswordController;
|
||||
use App\Http\Controllers\Auth\PasswordController;
|
||||
use App\Http\Controllers\Auth\PasswordResetLinkController;
|
||||
use App\Http\Controllers\Auth\RegisteredUserController;
|
||||
use App\Http\Controllers\Auth\VerifyEmailController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::middleware('guest')->group(function () {
|
||||
Route::get('register', [RegisteredUserController::class, 'create'])
|
||||
->name('register');
|
||||
|
||||
Route::post('register', [RegisteredUserController::class, 'store']);
|
||||
|
||||
Route::get('login', [AuthenticatedSessionController::class, 'create'])
|
||||
->name('login');
|
||||
|
||||
Route::post('login', [AuthenticatedSessionController::class, 'store']);
|
||||
|
||||
Route::get('forgot-password', [PasswordResetLinkController::class, 'create'])
|
||||
->name('password.request');
|
||||
|
||||
Route::post('forgot-password', [PasswordResetLinkController::class, 'store'])
|
||||
->name('password.email');
|
||||
|
||||
Route::get('reset-password/{token}', [NewPasswordController::class, 'create'])
|
||||
->name('password.reset');
|
||||
|
||||
Route::post('reset-password', [NewPasswordController::class, 'store'])
|
||||
->name('password.store');
|
||||
});
|
||||
|
||||
Route::middleware('auth')->group(function () {
|
||||
Route::get('verify-email', EmailVerificationPromptController::class)
|
||||
->name('verification.notice');
|
||||
|
||||
Route::get('verify-email/{id}/{hash}', VerifyEmailController::class)
|
||||
->middleware(['signed', 'throttle:6,1'])
|
||||
->name('verification.verify');
|
||||
|
||||
Route::post('email/verification-notification', [EmailVerificationNotificationController::class, 'store'])
|
||||
->middleware('throttle:6,1')
|
||||
->name('verification.send');
|
||||
|
||||
Route::get('confirm-password', [ConfirmablePasswordController::class, 'show'])
|
||||
->name('password.confirm');
|
||||
|
||||
Route::post('confirm-password', [ConfirmablePasswordController::class, 'store']);
|
||||
|
||||
Route::put('password', [PasswordController::class, 'update'])->name('password.update');
|
||||
|
||||
Route::post('logout', [AuthenticatedSessionController::class, 'destroy'])
|
||||
->name('logout');
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
Artisan::command('inspire', function () {
|
||||
$this->comment(Inspiring::quote());
|
||||
})->purpose('Display an inspiring quote');
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\Game\CharacterController;
|
||||
use App\Http\Controllers\Game\CrimeController;
|
||||
use App\Http\Controllers\Game\DashboardController;
|
||||
use App\Http\Controllers\Game\InventoryController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Game Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These routes are for the game-specific functionality.
|
||||
| All game routes require authentication and a character.
|
||||
|
|
||||
*/
|
||||
|
||||
// Redirect root to game dashboard if authenticated
|
||||
Route::get('/', function () {
|
||||
if (auth()->check() && auth()->user()->character) {
|
||||
return redirect()->route('game.dashboard');
|
||||
}
|
||||
return view('welcome');
|
||||
})->name('home');
|
||||
|
||||
// Game routes - require authentication and character
|
||||
Route::middleware(['auth', 'verify.character'])->group(function () {
|
||||
// Dashboard
|
||||
Route::get('/game', [DashboardController::class, 'index'])->name('game.dashboard');
|
||||
|
||||
// Character routes
|
||||
Route::prefix('game/character')->name('game.character.')->group(function () {
|
||||
Route::get('/create', [CharacterController::class, 'create'])->name('create')->withoutMiddleware(['verify.character']);
|
||||
Route::post('/', [CharacterController::class, 'store'])->name('store')->withoutMiddleware(['verify.character']);
|
||||
Route::get('/', [CharacterController::class, 'show'])->name('show');
|
||||
Route::get('/edit', [CharacterController::class, 'edit'])->name('edit');
|
||||
Route::put('/', [CharacterController::class, 'update'])->name('update');
|
||||
Route::post('/deposit', [CharacterController::class, 'deposit'])->name('deposit');
|
||||
Route::post('/withdraw', [CharacterController::class, 'withdraw'])->name('withdraw');
|
||||
Route::post('/revive', [CharacterController::class, 'revive'])->name('revive');
|
||||
});
|
||||
|
||||
// Crime routes
|
||||
Route::prefix('game/crimes')->name('game.crimes.')->group(function () {
|
||||
Route::get('/', [CrimeController::class, 'index'])->name('index');
|
||||
Route::get('/{crime}', [CrimeController::class, 'show'])->name('show');
|
||||
Route::post('/{crime}/attempt', [CrimeController::class, 'attempt'])->name('attempt')->middleware(['check.energy:crime']);
|
||||
});
|
||||
|
||||
// Inventory routes
|
||||
Route::prefix('game/inventory')->name('game.inventory.')->group(function () {
|
||||
Route::get('/', [InventoryController::class, 'index'])->name('index');
|
||||
Route::post('/{inventory}/equip', [InventoryController::class, 'equip'])->name('equip');
|
||||
Route::post('/{inventory}/unequip', [InventoryController::class, 'unequip'])->name('unequip');
|
||||
Route::post('/{inventory}/use', [InventoryController::class, 'use'])->name('use');
|
||||
Route::post('/{inventory}/drop', [InventoryController::class, 'drop'])->name('drop');
|
||||
});
|
||||
});
|
||||
|
||||
// Hospital route (for when character is in hospital)
|
||||
Route::middleware(['auth'])->group(function () {
|
||||
Route::get('/game/hospital', function () {
|
||||
$character = auth()->user()->character;
|
||||
if (!$character || (!$character->isInHospital() && !$character->isDead())) {
|
||||
return redirect()->route('game.dashboard');
|
||||
}
|
||||
$reviveCost = config('game.health.hospital_cost', 1000);
|
||||
$releaseTime = $character->in_hospital_until ? $character->in_hospital_until->diffForHumans() : 'unknown';
|
||||
return view('game.hospital', compact('character', 'reviveCost', 'releaseTime'));
|
||||
})->name('game.hospital');
|
||||
});
|
||||
|
||||
// Jail route (for when character is in jail)
|
||||
Route::middleware(['auth'])->group(function () {
|
||||
Route::get('/game/jail', function () {
|
||||
$character = auth()->user()->character;
|
||||
if (!$character || !$character->isInJail()) {
|
||||
return redirect()->route('game.dashboard');
|
||||
}
|
||||
$releaseTime = $character->in_jail_until ? $character->in_jail_until->diffForHumans() : 'unknown';
|
||||
return view('game.jail', compact('character', 'releaseTime'));
|
||||
})->name('game.jail');
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\ProfileController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
// Include game routes first (they handle the root route)
|
||||
require __DIR__.'/game.php';
|
||||
|
||||
// Keep the old dashboard route for compatibility
|
||||
Route::get('/dashboard', function () {
|
||||
if (auth()->check() && auth()->user()->character) {
|
||||
return redirect()->route('game.dashboard');
|
||||
}
|
||||
return view('dashboard');
|
||||
})->middleware(['auth', 'verified'])->name('dashboard');
|
||||
|
||||
// Profile routes
|
||||
Route::middleware('auth')->group(function () {
|
||||
Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
|
||||
Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
|
||||
Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
|
||||
});
|
||||
|
||||
// Authentication routes
|
||||
require __DIR__.'/auth.php';
|
||||
Reference in New Issue
Block a user