29 lines
1023 B
PHP
29 lines
1023 B
PHP
<?php
|
|
|
|
use App\Http\Controllers\CityController;
|
|
use App\Http\Controllers\Auth\LoginController;
|
|
use App\Http\Controllers\Auth\RegisterController;
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
// Homepage
|
|
Route::get('/', function () {
|
|
// Get popular cities with thumbnails
|
|
$popularCities = \App\Models\City::whereNotNull('thumbnail_url')
|
|
->inRandomOrder()
|
|
->limit(4)
|
|
->get(['id', 'name', 'slug', 'country', 'thumbnail_url']);
|
|
|
|
return view('welcome', compact('popularCities'));
|
|
});
|
|
|
|
// Authentication Routes
|
|
Route::get('/login', [LoginController::class, 'showLoginForm'])->name('login');
|
|
Route::post('/login', [LoginController::class, 'login']);
|
|
Route::post('/logout', [LoginController::class, 'logout'])->name('logout');
|
|
|
|
Route::get('/register', [RegisterController::class, 'showRegistrationForm'])->name('register');
|
|
Route::post('/register', [RegisterController::class, 'register']);
|
|
|
|
// City pages (web views)
|
|
Route::get('/cities/{city}', [CityController::class, 'show'])->name('cities.show');
|