I am creating a web site. So , there is a table to show users. In my database, I stored 0 for the Pending and 1 for the Approved under Action column. If some user has 0 , Pending will be displayed in this table and if the user has 1 Approved will be displayed. Now I want to when someone clicks this Pending button, I want to update database value to 1. I tried it as below. But , when I click Pending button, it gives me this error -
Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException
No message
And also I was unable to update the database value.
How Can I Fix this ??
View Page ( AdminPanel.blade.php )
<table class="table table-bordered">
<tr>
<td> Action</td>
</tr>
@foreach($data as $value )
<tr>
@if($value->action ==0)
<td><a href="actionedit/{{ $value->id }}"><input type="submit" name="pending" value="Pending"
class="btn btn-warning"></a></td>
@else
<td><a href="edit/{{ $value->id }}"><input type="submit" name="update" value="Approved"
class="btn btn-success"></a></td>
@endif
</tr>
@endforeach
</table>
Controller. ( AdminPanelController.php )
public function actionedit(Request $request)
{
// Add Validation
DB::table('users')
->update(['action' => 1]);
$request->session()->flash('Msg', 'Successfully Updated !!');
return redirect('adminPanel');
}
Route.
Route::put('/actionedit/{id}', 'AdminPanelController@actionedit');