📜  laravel 8 按 id 删除 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:31.605000             🧑  作者: Mango

代码示例1
//For a User table, to delete ID 1:

  $user = User::find(1);

  $user->delete();

//OR
  
  User::where('id', 1)->delete();

//OR
  
  User::destroy(1);

//OR
  
  User::destroy([1, 2, 3]);  //Delete id 1, 2 and 3