mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 20:44:19 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 12710f614b |
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
|
||||
class CreateTransactionLogsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('transaction_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('transaction_id');
|
||||
$table->morphs('owner');
|
||||
$table->string('type')->default(TransactionType::PAYMENT);
|
||||
$table->foreignId('issuer')->unsigned();
|
||||
$table->foreignId('receiver')->unsigned();
|
||||
$table->foreignId('recipient_bank_account_id')->unsigned();
|
||||
$table->string('payment_method')->nullable();
|
||||
$table->string('payment_reference')->nullable();
|
||||
$table->string('bill_no')->unique();
|
||||
$table->decimal('amount', 25, 5)->default(0.00);
|
||||
$table->decimal('original_amount', 25, 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('expires_on')->nullable();
|
||||
$table->integer('status')->default(ApprovalStatus::PENDING_SUBMISSION);
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('transaction_id')->references('id')->on('transactions');
|
||||
$table->foreign('currency_id')->references('id')->on('currencies');
|
||||
$table->foreign('issuer')->references('id')->on('company_modules');
|
||||
$table->foreign('receiver')->references('id')->on('company_modules');
|
||||
$table->foreign('original_currency_id')->references('id')->on('currencies');
|
||||
|
||||
});
|
||||
|
||||
//In-case the model name lengthy
|
||||
Schema::table('transaction_logs', function (Blueprint $table) {
|
||||
$table->string('owner_type', 250)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('transaction_logs');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user