I want to build a simple multi-stage registration process in Laravel 5.5, without having to resort to JavaScript, but I'm not sure if it's possible.
My routes are fairly simple:
Route::get('/stage1', 'UserController@showWelcome')->name('welcome');
Route::post('/stage1', 'UserController@validateWelcome');
Route::get('/stage2', 'UserController@create')->name('register');
Route::post('/stage2', 'UserController@store');
In the UserController...
@showWelcome -> shows stage1.blade.php .
@validateWelcome -> validates the input and then return view('stage2'), compact('request')
@create -> shows stage1.blade.php (not a mistake -- it's not POSTed so they should see stage1)
@store -> validates the input and return view('stagesComplete')
The problem
Everything works perfectly except when there's a validation error during stage 2. The page is submitted but it shows the error messages on stage1.
I've ensured that the stage1 form POSTs to /stage1, and the same for /stage2 (it POSTs to /stage2).
I've tried redirecting to /stage2 @validateWelcome, but of course you can't POST with a redirect.
Am I missing something, or is it just not possible?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2yA7jEB
via IFTTT
Aucun commentaire:
Enregistrer un commentaire