为什么不删除Laravel中的DB记录?

working with Laravel 5.6 and I am going to delete table record from uploads images table. this is controller

 public function deleteOneImage($id)
    {
        Upload::where('id', $id)->delete();
        return redirect()->back()->with('info', 'Image deleted successfully');
    }

and delete link in edit.blade.php

 <a class="button is-outlined" href="/myads/{{$upload->id}}/delete" onclick="return confirm('Are you sure to want to delete this record?')" >Delete</a></td>

and route

Route::get('myads/{uploads}/delete', [
    'uses' => '\App\Http\Controllers\VehicleController@deleteOneImage',
]);

but when I clicked delete buttons it does not delete the table records? how can I fix this problem?

Maybe this could work:

<a class="button is-outlined" href="{{url('myads/'. $upload->id .'/delete')}}" onclick="return confirm('Are you sure to want to delete this record?')" >Delete</a>

Try this, I hope this will help you.

in your blade:

<a onclick="event.preventDefault();document.getElementById('{{md5($upload->id."delete")}}').submit();">Delete</a>

<form id="{{md5($upload->id.'delete')}}" action="{{ route('myads.destroy',$upload->id) }}" method="POST">
  {{ csrf_field() }}
  <input type="hidden" name="_method" value="DELETE">
</form>

And change your route like this:

Route::delete('myads/{uploads}','VehicleController@deleteOneImage',)->name('myads.destroy');

And write this in controller:

public function deleteOneImage($id)
    {
        Upload::findOrFail($id)->delete();
        return redirect()->back()->with('info', 'Image deleted successfully');
    }

Hope it will help you