久久久久久久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)
主站蜘蛛池模板: 国产精品福利在线 | 日韩精品二区 | 日日操操 | 91麻豆精品一区二区三区 | 99久久精品国产一区二区三区 | 成人免费看黄 | 亚洲精品视频一区二区三区 | 免费黄色的网站 | 国产精品色哟哟网站 | 成人午夜精品一区二区三区 | 日韩精品中文字幕一区二区三区 | 欧美一级片 | 五月综合久久 | 欧美国产日韩在线观看 | 精品九九在线 | 国产精品海角社区在线观看 | 韩国理论电影在线 | 中文字幕成人av | 日韩中文字幕在线不卡 | 亚洲人精品午夜 | 婷婷中文字幕 | 中文字幕一区二区视频 | 亚洲天堂一区二区 | 免费性视频 | 中文字幕国产视频 | 中文字幕av一区二区三区 | 欧美精品在线一区二区三区 | 天天艹 | av网站推荐 | 国产日韩欧美一区二区 | 激情五月婷婷在线 | 国产98色在线 | 日韩 | 国产专区在线 | 在线观看欧美一区 | 国产一区 | 日日噜噜夜夜爽爽狠狠 | 国产资源在线播放 | 在线观看av中文字幕 | 亚洲国产欧美日韩 | 国产精品久久久久国产a级 欧美日韩国产免费 | 色姑娘av|