6 months ago

Problem with calling another function from the same controller

Posted 6 months ago by Giorgiovski

I have a page with many forms. I have different routes for the actions. I don't know why when I'm clicking another function actually don't let me submit because it is calling the validate function FROM ANOTHER FUNCTION from the controller.

I receive the message: the session date is required. But the functions are different. Why is called the second function? Thank you.


{!! Form::open(['route' => ['session.updateEverySessionByClick', auth()->user()->id]]) !!}
                                                                        {{Form::text('sessionHourForUpdate', '', ['class' => 'form-control', 'id' => 'sessionHourForUpdate'])}}
                                                                        {{Form::submit('Update session status', ['class' => 'btn btn-sm btn-primary', 'id' => 'submitUpdateStatusOfSession'])}}

The routes

Route::post('profile/{id}', '[email protected]')->name('');
Route::post('profile/{id}', '[email protected]')->name('session.updateEverySessionByClick');

The controller functions

class SessionController extends Controller

    public function updateEverySessionByClick(Request $request, $trainerId){
        $ceva = $request->sessionHourForUpdate;
        return redirect('profile/'.auth()->user()->id)->with('success', $ceva);

    public function saveSession(Request $request, $trainerId){

    //rest of the code

Please sign in or create an account to participate in this conversation.