This commit is contained in:
foobar
2022-08-21 21:39:06 +02:00
commit 27c1969aaa
7354 changed files with 897064 additions and 0 deletions

48
routes/web.php Normal file
View File

@@ -0,0 +1,48 @@
<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\CityController;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This application only has a single view which contains a form for adding new cities as well as a listing of all current cities.|
| |
*/
/**
* Show City Dashboard
*/
Route::get('/', [CityController::class, 'show']);
/**
* Add New City
*
* The form in our view will create a new city via POST request.
* We will use the validate method provided by the Illuminate\Http\Request object. If the validation rules pass, your code will keep executing normally; however, if validation fails, an Illuminate\Validation\ValidationException exception will be thrown and the proper error response will automatically be sent back to the user.
* If validation fails during a traditional HTTP request, a redirect response to the previous URL will be generated. If the incoming request is an XHR request, a JSON response containing the validation error messages will be returned.
* If the validation fails, we will redirect the user back to the / URL, as well as flash the old input and errors into the session.
*
* Fun Fact: There is a city called Taumatawhakatangihangakoauauotamateapokaiwhenuakitanatahu (85 characters) in New Zealand, so we allow max. 85 characters for city names.
* TODO: Change validate language to german.
*/
Route::post('/city', [CityController::class, 'create']);
/**
* Delete City
*
* Once the record is deleted, we will redirect the user back to the / endpoint.
*/
Route::delete('/city/{id}', [CityController::class, 'delete']);
/**
* Refresh weather data
*/
Route::post('/refresh', [CityController::class, 'refresh']);
/**
* Generate Bearer-Token for Laravel Sanctum API authentication
*/
Route::get('/setup', [CityController::class, 'setup']);