Jonah Hart
Jonah Hart

Reputation: 35

Laravel: Action not defined

I'm having this error occur:

Route [/update] not defined. (View: C:\Server\nginx-1.13.1\html\developer\resources\views\profile.blade.php)"

For this route:

Route::post('/update', 'ProfileController@update');

and this view:

<form class=card method=POST action={{ route('/update') }}>

Upvotes: 1

Views: 1103

Answers (3)

Saurabh Mistry
Saurabh Mistry

Reputation: 13669

in your web.php , you should give name to your route , then you can access that route by name in blade

Route::post('/update', 'ProfileController@update')->name('update');

in your blade template

<form class=card method=POST action={{ route('update') }}>

Upvotes: 0

kristi tanellari
kristi tanellari

Reputation: 135

or you can just change route to url or asset like this

 <form class=card method=POST action={{ url('/update') }}>

Upvotes: 0

Tarek Adam
Tarek Adam

Reputation: 3525

the route() method takes the name not the path

Route::post('/update', ['as' => 'my-update', 'uses' => 'ProfileController@update']);

then call route('my-update')

Upvotes: 2

Related Questions