久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

CRUD Laravel 5 如何鏈接到資源控制器的銷毀?

CRUD Laravel 5 how to link to destroy of Resource Controller?(CRUD Laravel 5 如何鏈接到資源控制器的銷毀?)
本文介紹了CRUD Laravel 5 如何鏈接到資源控制器的銷毀?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有一個鏈接

<a class="trashButton" href="{{ URL::route('user.destroy',$members['id'][$i]) }}" style="cursor: pointer;"><i class="fa fa-trash-o"></i></a> 

這個鏈接應該指向 Usercontroller 的 destroy 方法,這是我的路由 Route::resource('/user', 'BackEndUsersController');

this link is supposed to direct to the destroy method of the Usercontroller , this is my route Route::resource('/user', 'BackEndUsersController');

UserController 是一個資源控制器.但此時它正在將我定向到 show 方法而不是定向到 destroy 方法

UserController is a Resource Controller. But at this moment it is directing me to the show method rather than directing to the destroy method

推薦答案

這是因為您通過 GET 方法而不是 DELETE 方法請求資源.看:

This is because you are requesting the resources via GET method instead DELETE method. Look:

DELETE  /photo/{photo}  destroy     photo.destroy
GET     /photo/{photo}  show    photo.show

兩條路由具有相同的 URL,但標頭動詞標識要調用的路由.查看 RESTful 表.例如,您可以通過 ajax 發送 DELETE 請求:

Both routes have the same URL, but the header verb identifies which to call. Looks the RESTful table. For example, via ajax you can send a DELETE request:

$.ajax({
    url: '/user/4',
    type: 'DELETE',  // user.destroy
    success: function(result) {
        // Do something with the result
    }
});

這篇關于CRUD Laravel 5 如何鏈接到資源控制器的銷毀?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Magento products by categories(按類別劃分的 Magento 產品)
Resource interpreted as image but transferred with MIME type text/html - Magento(資源被解釋為圖像但使用 MIME 類型 text/html 傳輸 - Magento)
Is there an event for customer account registration in Magento?(Magento 中是否有客戶帳戶注冊事件?)
Magento addFieldToFilter: Two fields, match as OR, not AND(Magento addFieldToFilter:兩個字段,匹配為 OR,而不是 AND)
quot;Error 404 Not Foundquot; in Magento Admin Login Page(“未找到錯誤 404在 Magento 管理員登錄頁面)
Get Order Increment Id in Magento(在 Magento 中獲取訂單增量 ID)
主站蜘蛛池模板: 久久精品久久久久 | 不卡免费视频 | 欧美成人精品一区二区三区 | 一级片欧美 | 精品一区二区三区四区 | 欧美成人精品欧美一级私黄 | 快播少女爱欢乐 | 精品久久国产 | 国产精品视频专区 | 97色在线| 五月天激情国产综合婷婷婷 | 欧美在线免费 | 天堂网中文 | www.wuye| 三级视频网站 | 欧美日韩国产激情 | 久综合 | 国产黄a三级三级三级看三级男男 | 久久久久久久 | 国产三级做爰高清在线 | 欧美在线视频播放 | 手机av片| 深夜福利在线播放 | 国产成人精品视频 | 国产精品欧美在线 | 国产精品一区二区在线播放 | 黄色在线小视频 | 久久久久久久久久一区二区三区 | 成人一级毛片 | 亚洲午夜剧场 | 日韩欧美国产成人 | 亚洲激情视频 | 91久久久久久久久久 | 天天拍夜夜操 | 久久亚洲免费视频 | aaa亚洲| 天天操夜夜爽 | 伊人9999| 欧美伦理一区二区 | 欧美视频一区二区三区 | 久久99精品久久久久久琪琪 |