Home > front end >  Deleting a row in the laravel database
Deleting a row in the laravel database

Time:10-17

I want to delete a row in the user_guilds table. If the title in the servers table is equal to guild_id in the user_guilds table

$servers[] = DB::table('servers')->select('title')->get();
$servers = json_decode(json_encode($servers), true);
DB::table('user_guilds')->where('guild_id','=', $servers)->delete();

I wrote like this, and it works only the first time, and about the trace of the action, it is not deleted

CodePudding user response:

$servers[] = DB::table('servers')->select('title')->get();
$servers = json_decode(json_encode($servers), true);
DB::table('user_guilds')->whereIn('guild_id', $servers)->delete();
  • Related