This is my Routes:
/*
* Photos route group
*/
Route::group(['prefix' => 'admin/photos', 'middleware' => 'auth'], function(){
Route::get('/edit/{id}', 'PhotoController@edit')->name('photos.edit');
Route::get('/new', 'PhotoController@create')->name('photos.new');
Route::get('/', 'PhotoController@index')->name('photos.show');
Route::post('/', 'PhotoController@store')->name('photos.save');
Route::put('/update/{id}', 'PhotoController@update')->name('photos.update');
});
And this is my update method in photo model:
public function update(Request $request, Photo $photo, $id)
{
//return [$request->all(), $photo::all()];
return $id;
}
And finally this is where my form will be created
<form action="">
BUT when I use this configuration, laravel return methodNotAllowedException
. when I change put
method to post
, again this will return same result, But when I change method to get
the page will work fine.
I did reorder my routes in web.php
file but the problem exists again.
Do you what is wrong in my code?
NOTE :
I have some other update methods in other models and these are OK, This problem occurs just for this model...
Thanks in Advance
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire