My name is jeff My name is jeff - 3 years ago 450
PHP Question

Laravel MethodNotAllowedHttpException

I have Permission Roles that i want to delete when i click on them so i did a route that takes role id and permission id

Route::post('management/role-permission/{role_id}/{permission_id}', 'RolePermissionsController@Delete');

And i get this route from link from my html:

@foreach($data as $dat)
<div class="col-xs-3 text-center">
<form action="/management/role-permission/{{$role->id}}/{{$dat->id}}" method="POST">
{!! csrf_field() !!}
<button onclick="return confirm('Are you sure?')" class="btn turquoiseButton btn-margin full-width"><i class='fa fa-close close-btn'></i> {{$dat->name}} </button>


And the route goes to this controller :

public function Delete( $role_id ,$permission_id)
->where('role_id' ,$role_id)
->where('permission_id' ,$permission_id)
return Redirect::to('/management/role-permission/'.$role_id . '/list');

But i keep getting this error for no reason


Answer Source


Route::post('management/role-permission/{role_id}/{permission_id}', 'RolePermissionsController@Delete');


Route::delete('management/role-permission/{role_id}/{permission_id}', 'RolePermissionsController@Delete');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download