mirror of
https://gitlab.com/uldvstar/exchange-2.0.git
synced 2026-08-21 13:34:15 +00:00
51 lines
1.6 KiB
PHP
51 lines
1.6 KiB
PHP
<?php
|
|
|
|
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
class CreateReceiptsTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::create('receipts', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('transaction_id')->unsigned();
|
|
$table->string('bill_no')->unique();
|
|
$table->decimal('amount', 14, 5)->default(0.00);
|
|
$table->decimal('original_amount', 14, 5)->default(0.00);
|
|
$table->foreignId('currency_id')->unsigned();
|
|
$table->foreignId('original_currency_id')->unsigned();
|
|
$table->decimal('currency_rate', 14, 5)->default(0.00);
|
|
$table->decimal('tax', 14, 5)->default(0.00);
|
|
$table->decimal('service_charge', 14, 5)->default(0.00);
|
|
$table->timestamp('transaction_date')->useCurrent();
|
|
$table->integer('status')->default(ApprovalStatus::COMPLETED);
|
|
$table->softDeletes();
|
|
$table->timestamps();
|
|
|
|
$table->foreign('transaction_id')->references('id')->on('transactions');
|
|
$table->foreign('currency_id')->references('id')->on('currencies');
|
|
$table->foreign('original_currency_id')->references('id')->on('currencies');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('receipt');
|
|
}
|
|
}
|