0

So what I'm trying to do is delete a row from my database table with a icon button (href)

<a href='notstarted/delete/{{$task->idtask}}' style="color: #8B0000"><span title="Delete Task"><i class="far fa-trash-alt"></i></span></a>

Here is my controller

    public function destroy($idtask) {
    DB::delete('delete from tasks where idtask = ?',[$idtask]);

    return redirect('/todo/notstarted');
}

and here is my routing:

Route::get('notstarted/delete/{idtask}','NotstartedController@destroy');

so my button is on page /todo/notstarted , when i click it it goes to /todo/notstarted/delete/1 like I want but it shows the laravel 404|Not Found page. Normally the redirect in my controller should work but for some reason it broke.

here is a picture of my folder structure of my views: enter image description here

Hopefully someone can help!

Plance Development
  • 45
  • 1
  • 1
  • 13

1 Answers1

0

the problem is your anchor tag's href you should use laravel url() helper.

like the code below :

<a href="{{url('notstarted/delete/',$task->idtask)}}" style="color: #8B0000">
   <span title="Delete Task"><i class="far fa-trash-alt"></i></span>
</a>