laravel的唯一驗證怎么過濾軟刪除的數據
1 回答

開心每一天1111
TA貢獻1836條經驗 獲得超13個贊
刪除鏈接
編輯在app/views/articles/index.blade.php文件,在列表視圖每個文章后面,添加刪除菜單:
MENU:
{{ Form::open(array('method' => 'DELETE', 'route' => array('articles.destroy', $article->id))) }}
{{ Form::submit('Delete') }}
{{ Form::close() }}
執行刪除
修改 ArticlesController 控制器 destroy 動作的代碼:
public function destroy($id)
{
Article::destroy($id);
return Redirect::route('articles.index');
}
注意,刪除后,直接跳轉到列表頁面。
- 1 回答
- 0 關注
- 981 瀏覽
添加回答
舉報
0/150
提交
取消