I have a GET route with a wildcard day.
This day wildcard is a string like so: 20220507 (YYYYMMDD).
After validation the string I wish to make a proper response. Before sending the response I want to validate the string length and the format.
My question is, is it possible to validate the string with Illuminate\Foundation\Http\FormRequest ou Illuminate\Http\Request make:request ? Or they only accepet Post Requests ?
Code:
php artisan make:request CalendarDayRequest
Example get route in web.php
Route::get('/calendar/{day}' , 'App\Http\Controllers\HomeController@calendar')->name('calendar');
Example Controller
use App\Http\Requests\CalendarDayRequest;
public function calendar ( CalendarDayRequest $request ) {
// Code
}
Or Example Controller 2
use Illuminate\Http\Request;
public function calendar ( Request $request ) {
$validated = $request->validate([
'day' => 'required',
]);
}
Both of them I got the error: infinite redirect loop, redirected it too many times.