Laravel - Eloquent 删除数据

    public function ormDelete()
    {
        # 1.通过模型删除
        // $student = Student::where('id',5);
        // $student->delete();

        # 2.通过主键值删除
        
        ## 2.1 删除单个
        // Student::destroy(14);
        
        ## 2.4 删除多个
        // Student::destroy(11,13);
        // Student::destroy([1,4]);

        # 3.根据指定条件删除
        Student::where('id',3)->delete();
    }
posted @ 2020-04-27 20:42  武卡卡  阅读(1810)  评论(0编辑  收藏  举报