Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

likecastillo's avatar

Issue with Delete Method (Laravel Kanban Board)

Hello! I'm following Tallpad's tutorial on Creating a Kanban Board and It seems that I can't delete boards with my code. I'm trying to copy what was provided in the tutorial, but the videos only provided it with deleting card items but not the cardlist or boards of the kanbanboard.

The original snippets of code to delete the cards looks like this:

CardListItemModal.vue

		<Link
       :href="`/cards/${card?.id}`"
       method="delete"
       as="button"
       class="inline-flex items-center px-4 py-2 text-sm font-medium text-white bg-red-500 rounded-md 									 shadow-sm hover:bg-red-700 focus:ring-2 focus:ring-offset-2 focus:ring-rose-500 focus:outline-none"
              >
       <TrashIcon class="mr-1 -ml-1 w-4 h-4 shrink-0"/>
       <span>Delete card</span>
       </Link>

CardListController.php

public function destroy(Card $card)
{
    $card->delete();
    return redirect()->route('boards.show', ['board' => $card->board_id]);
}

web.php (routes)

      Route::delete('/cards/{card}', [CardController::class, 'destroy'])->name('cards.destroy');

The ones I edited look like this

Show.vue

<transition
    enter-active-class="transition transform duration-100 ease-out"
    enter-from-class="opacity-0 scale-90" 
    enter-to-class="opacity-100 scale-100"
    leave-active-class="transition transform duration-100 ease-in" 
    leave-from-class="opacity-100 scale-100"
    leave-to-class="opacity-0 scale-90">
    <MenuItems
        class="origin-top-right right-0 mt-2 focus:outline-none absolute bg-gray-200 overflow-hidden rounded-md shadow-lg border w-40">
        <MenuItem v-slot="{ active }">
        <Link 
            href="/boards"
            method="delete"             
            :class="{ 'bg-green-400': active }" class="block px-4 py-2 text-sm text-gray-700">
            Delete Board</Link>
        </MenuItem>

    </MenuItems>
</transition>

BoardController.php

public function destroy(Board $board)
{
    $board->delete();
    return redirect('/boards');
}

web.php route:

Route::delete('/boards/{board}', [BoardController::class, 'destroy'])->name('boards.destroy');

I would like to know where did I go wrong here. Any help is greatly appreciated, as someone who's not a coder :) Thank you so much!

Main error atm : The DELETE method is not supported for route boards. Supported methods: GET, HEAD, POST.

0 likes
3 replies
tykus's avatar
tykus
Best Answer
Level 104

The DELETE route expects the ID of the Board you want to destroy, but you do not provide one in the URL:

<Link 
    href="/boards"
    method="delete"             
    :class="{ 'bg-green-400': active }" class="block px-4 py-2 text-sm text-gray-700">

Instead, you are using the URL for another route (probably for listing all Boards?).

If you have a board Object in the component, then using its ID on the Link href should work:

<Link 
    :href="`/boards/${board.id}`"
    method="delete"             
    :class="{ 'bg-green-400': active }" class="block px-4 py-2 text-sm text-gray-700">

Aside, if using Inertia with one of Laravel's starter kits, you should also have Ziggy installed, in that case you have its route helper in your Javascript application.

<Link 
    :href="route('boards.destroy', board.id)"
    method="delete"             
    :class="{ 'bg-green-400': active }" class="block px-4 py-2 text-sm text-gray-700">
1 like
likecastillo's avatar

@tykus Sorry for the late reply, but this was extremely helpful! I got it working thanks to this.

im-nazmul's avatar

Something doesn't seem right to me. You are not passing anything from the Show.vue to BoardController@destroy but expecting a Board $board object.

1 like

Please or to participate in this conversation.