string('type')->nullable(); }); } if (!Schema::hasColumn('links', 'type_params')) { Schema::table('links', function (Blueprint $table) { $table->text('type_params')->nullable(); }); } $links = Link::all(); foreach ($links as $link) { $type = null; $params = false; switch ($link->button_id) { case "1": $type = "link"; break; case "2": $type = "link"; break; case "43": $type = "spacer"; $params = true; break; case "42": $type = "heading"; $params = true; break; case "93": $type = "text"; $params = true; break; case "44": $type = "telephone"; break; case "6": $type = "email"; break; case "96": $type = "vcard"; break; } if ($type !== null) { $link->type = $type; if ($params === true) { $link->type_params = json_encode(["custom_html" => true]); } $link->save(); } } }