Supprimer plusieurs lignes à Laravel
DB::table('users')->delete();
DB::table('users')->where('votes', '>', 100)->delete();
Mohamad
DB::table('users')->delete();
DB::table('users')->where('votes', '>', 100)->delete();
App\Post;
$post = Post::find($id);
Comment::where('post_id',$post)->delete();
public function destroy($id)
{
if (is_array($id))
{
Product::destroy($id);
}
else
{
Product::findOrFail($id)->delete();
}
// redirect or whatever...
}
$org->products()->whereIn('id', $ids)->delete()
public function deleteAll(Request $request)
{
$ids = $request->ids;
DB::table("products")->whereIn('id',explode(",",$ids))->delete();
return response()->json(['success'=>"Products Deleted successfully."]);
}
//@sujay