It works fine on my local server and computer when I upload it to the online server and whenever I try to update a field like description or sometimes when inserting I get 405 and says that method is not allowed.
I used same method (POST) as in web.php and also in my view.
<form action="/updateannouncement" method="post" enctype="multipart/form-data">
@csrf
<input type="hidden" name="id" value="{{ $announce->id }}">
<div class="form-group">
<label class="col-form-label" for="title"><i class="fa fa-pen"></i> Announcement
Title</label>
<input type="text" name="title" class="form-control" value="{{ $announce->title }}" id="title"
placeholder="Enter ..." required>
</div>
this is web.php
Route::post('/insertannouncement', 'announcementController@insert');
Route::post('/updateannouncement', 'announcementController@update')->middleware('restrict');
I realy want help on this guys!!!
2
Answers
Instead of adding a route name like
/updateannouncement
use the route name in the form. see in the Laravel docIn your case, it should be like this…
and use in the form
run following command :
or
if it didn’t work, take a look on your middleware