删除在 lumen 中不起作用的查询

Delete query not working in lumen

我只是想从 lumen 中删除一条记录。

我的 html 查看按钮:

<li><a href="{!!url('delete-list'. $value->page_id) !!}"class="dangrclr"><i class="fa fa-trash-o"></i>Delete</a></li>

我的控制器:

public function deleteList($page_id)
{
   $list= DB::table('page_master')->where('page_id',$page_id);
   $list->delete();
    return Redirect::to('page-list');
}

我的 routes.php 文件看起来像:

$router->get('delete-list/{id}', 'AjaxController@deleteList');

当我点击删除按钮时,它显示

Sorry, the page you are looking for could not be found.
NotFoundHttpException

当我点击删除按钮时显示的 url 是:

http://localhost:8000/delete-list3

我做错了什么?

将此更改为

<a href="{!!url('delete-list'. $value->page_id) !!}"

这个

<a href="{{ url('delete-list/'.$value->page_id) }}"

URL 现在 - http://localhost:8000/delete-list3 应该是 http://localhost:8000/delete-list/3


你也可以使用 route()

"{{route('delete-list',$value->page_id)}}"

您忘记在代码中使用 /。应该是url('delete-list/'. $value->page_id)