You should concatenate the $row->id to the route path:
<form action="{{ url('/setting/destroy/' . $row->id) }}" method="POST">
EDIT: simplified route concatenation
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello i'm trying to create a CRUD webstite but when i'm in delete i get this error.
Here is my view
<form action="{{ url('/setting/destroy'), $row->id }}" method="POST"></form>
<td>
@csrf
@method('delete')
<button class="btn btn-danger" type="submit"> Delete</button>
</td>
</form>
My route
Route::delete('/setting/destroy/{id}', [ItemController::class, 'destroy']);
my controller
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy(ItemPage $itemPage, $id)
{
//
$itemPage->delete();
if($itemPage){
return redirect('/setting_div')->with('success', 'Item berhasil dihapus ');
}else{
return redirect('/setting_div')->with('error', 'Item succesfully deleted');
}
}
I want to try to change the form from URL into Route, but when i'm trying to use route it always said that "Route is not defined"
Please or to participate in this conversation.