M
M
marq2021-11-27 11:29:34
Laravel
marq, 2021-11-27 11:29:34

Laravel action not working?

Good afternoon, there are two forms on the page, one leads to the saveProfile method, the second to createTeam, but as soon as the second form is created, it gives an error Action App\Http\Controllers\[email protected] not defined
routes:

Route::post('/profile',[\App\Http\Controllers\ProfileController::class, 'saveProfile']);
 Route::post('/profile',[\App\Http\Controllers\ProfileController::class, 'createTeam']);

Second form:
<form  method="POST" action="{{action('App\Http\Controllers\[email protected]') }}">
                         
                            <input class="input-footer"  name="team" placeholder="Название команды"  type="text">
                            <button class="submit-btn btn--size btn--mr">Создать</button>
                        </form>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
TheAndrey7, 2021-11-27
@TheAndrey7

The routes are exactly the same. How should the router tell them apart if the path and http method are the same?
The route should be given a name and retrieved from it for the form.

S
Sergey delphinpro, 2021-11-27
@delphinpro

Use Google Translate, Luke!
Quite clearly written - Action not defined.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question