From 8b3b3de9a82f2b97567404ed761af5e7ca68d832 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Fri, 2 Aug 2024 12:05:21 +0200 Subject: [PATCH] Fix: update single name in migrations --- database/migrations/2024_07_31_215841_update_users_names.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/migrations/2024_07_31_215841_update_users_names.php b/database/migrations/2024_07_31_215841_update_users_names.php index e81e21be..7fb166ab 100644 --- a/database/migrations/2024_07_31_215841_update_users_names.php +++ b/database/migrations/2024_07_31_215841_update_users_names.php @@ -25,7 +25,7 @@ return new class extends Migration foreach (DB::table('users')->get() as $user) { [$firstname, $lastname] = explode(' ', $user->name); - DB::table('users')->where('id', $user->id)->update(['firstname' => $firstname, 'lastname' => $lastname]); + DB::table('users')->where('id', $user->id)->update(['firstname' => $firstname ?? '', 'lastname' => $lastname ?? '']); } Schema::table('users', function (Blueprint $table) {