Answers for "laravel delete multiple rows"

PHP
2

delete multiple row in laravel

DB::table('users')->delete();

DB::table('users')->where('votes', '>', 100)->delete();
Posted by: Guest on July-15-2021
1

how delete multiple row from relation in laravel

App\Post;
$post = Post::find($id);
Comment::where('post_id',$post)->delete();
Posted by: Guest on April-20-2021
1

delete multiple row by model in laravel

public function destroy($id)
{
    if (is_array($id)) 
    {
        Product::destroy($id);
    }
    else
    {
        Product::findOrFail($id)->delete();
    }
    // redirect or whatever...
}
Posted by: Guest on August-07-2021
0

How to Delete Multiple Records using Checkbox in Laravel

public function deleteAll(Request $request)
{
  $ids = $request->ids;
  DB::table("products")->whereIn('id',explode(",",$ids))->delete();
  return response()->json(['success'=>"Products Deleted successfully."]);
}
//@sujay
Posted by: Guest on February-02-2021
-1

laravel delete multiple rows

$org->products()->whereIn('id', $ids)->delete()
Posted by: Guest on February-26-2021

Code answers related to "laravel delete multiple rows"

Browse Popular Code Answers by Language