DONE: store mykad image in database

This commit is contained in:
ISMAIL MASSERAN
2026-09-03 11:29:13 +08:00
parent 52c3f5a52f
commit 0213f40b11
4 changed files with 170 additions and 5 deletions
@@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddGambarMykadToCustomerTable extends Migration
{
/**
* Master DB (mysql7) — stores arrahn_files.id for the MyKad photo.
*
* @return void
*/
public function up()
{
if (
Schema::connection('mysql7')->hasTable('customer')
&& !Schema::connection('mysql7')->hasColumn('customer', 'gambar_mykad')
) {
Schema::connection('mysql7')->table('customer', function (Blueprint $table) {
if (Schema::connection('mysql7')->hasColumn('customer', 'tag_anggota')) {
$table->unsignedBigInteger('gambar_mykad')->nullable()->after('tag_anggota');
} else {
$table->unsignedBigInteger('gambar_mykad')->nullable();
}
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
if (
Schema::connection('mysql7')->hasTable('customer')
&& Schema::connection('mysql7')->hasColumn('customer', 'gambar_mykad')
) {
Schema::connection('mysql7')->table('customer', function (Blueprint $table) {
$table->dropColumn('gambar_mykad');
});
}
}
}