I want to delete an image and return back to user page, so i try to pass 2 parameter to my controller (my userid and image_id).
But I get this error
Too few arguments to function App\Http\Controllers\McuFormDocumentController::destroy(), 1 passed and exactly 2 expected
My button code in blade
<button id="delete" class="btn btn-danger btn-sm" data-title="{{ $mcu_form_document['title'] }}"
style="color: #fff; font-size: 1.2em;"
href="{{ route('mcu-form-document.destroy', ['id'=>$id ,'img'=>$mcu_form_document['id']]) }}">
Delete <i class="la la-trash" style="color: #fff; font-size: 1.2em;"></i>
</button>
<form action="{{ route('mcu-form-document.destroy', ['id'=>$id ,'img'=>$mcu_form_document['id']]) }}" method="post" id="deleteForm">
{{ csrf_field() }}
{{ method_field('DELETE') }}
<input type="submit" value="" style="display:none;">
</form>
My controller
public function destroy($id,$img_id)
{
$mcu_form_document = McuFormDocument::find($img_id);
$mcu_form_document->delete();
return redirect()
->route('mcu.resume.list', ['id' => $id])
->with('success', 'Document has been successfully deleted!');
}
my route
Route::resource('mcu-resume', 'McuResumeController');
php artisan route:listthat resource isn't going to make any route with more than 1 parameter