PHP Snippet 1:
Schema::table('pasien', function (Blueprint $table) {
$table->unique('RM_id');
});
PHP Snippet 2:
public function up()
{
Schema::create('pasien', function (Blueprint $table) {
$table->increments('id');
$table->string('No_RM')->unique();
$table->timestamps();
});
}
PHP Snippet 3:
public function up()
{
Schema::create('data_primary', function (Blueprint $table) {
$table->increments('id');
$table->string('RM_id');
$table->string('file_primary');
$table->timestamps();
$table->foreign('RM_id')->references('RM_id')->on('pasien')
->onUpdate('cascade')->onDelete('cascade');
});
}