<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateBranchesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('branches', function (Blueprint $table) {
            $table->id();
            $table->string('branch_code',100)->nullable();
            $table->string('name_en',100)->nullable();
            $table->string('name_km',100)->nullable();
            $table->string('phone',100)->nullable();
            $table->string('address',200)->nullable();
            $table->string('image')->nullable();
            $table->string('image1')->nullable();
            $table->string('province_id',2)->nullable();
            $table->string('district_id',4)->nullable();
            $table->string('commune_id',6)->nullable();
            $table->string('village_id',8)->nullable();
            $table->string('branch_prefix', 7)->nullable();
            $table->string('client_prefix', 7)->nullable();
            $table->string('co_prefix', 7)->nullable();
            $table->string('user_prefix', 7)->nullable();
            $table->string('loan_prefix', 7)->nullable();
            $table->string('invoice_prefix', 7)->nullable();
            $table->tinyInteger('status_id')->default(1);
            $table->tinyInteger('created_by')->default(1);
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('branches');
    }
}
