0

i'm validating a form with this:

public function update(UpdateExamenRequest $examenRequest, UpdateResultadoRequest $resultadoRequest)
    {
        $examenRequest->validated();
        $resultadoRequest->validated();

This are the rules in UpdateExamenRequest

public function rules()
    {
        $this->redirect = url()->previous();

        return [
            'Paciente_id' => 'required|string|max:10',
            'Examen_id' => 'required|string|max:10',
            'Nombre' => 'required|string|max:50',
            'Descripcion' => 'nullable|string',
        ];
    }

public function messages()
    {
        return [
            'Paciente_id.required' => __('Paciente_id.required'),
            'Examen_id.required' => __('Examen_id.required'),
            'Nombre.required' => __('Nombre.required'),
            'Nombre.string' => __('Nombre.string'),
            'Nombre.max' => __('Nombre.max'),
            'Descripcion.string' => __('Descripcion.string'),
        ];
    }

My routes:

Route::get('/', function () {
    return view('auth.login');
})->middleware('guest');;

Route::get('/welcome', function () {
    return view('welcome');
})->name('welcome');

Route::get('/dashboard', function () {
    return view('dashboard');
})->middleware(['auth'])->name('dashboard');

require __DIR__ . '/auth.php';

Route::resource('pacientes', PacientesController::class)->middleware('auth');
Route::resource('examenes', ExamenesController::class)->middleware('auth');
Route::resource('resultados', ResultadoController::class)->middleware('auth');

i'm having a situation, and i've really don't know whats happening. The validation sends me to the show view, that i haven't created yet, there is a video: https://youtu.be/S-PtTdUH13Y

elgranchuchu
  • 333
  • 1
  • 5
  • 18
  • 1
    at least you should not trying to do two validations via form request, it won't work. take a look at that https://stackoverflow.com/questions/48370879/laravel-5-5-validate-multiple-form-request-at-the-same-time – Roman Meyer Mar 13 '21 at 22:39
  • Roman thank you for the link, that's the answer. – elgranchuchu Mar 13 '21 at 22:48

0 Answers0