Fixes and tests for the journal and journaled transactions #130
This commit is contained in:
9
app/Database/factories/JournalFactory.php
Normal file
9
app/Database/factories/JournalFactory.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(App\Models\Journal::class, function (Faker $faker) {
|
||||
return [
|
||||
'currency' => 'USD',
|
||||
];
|
||||
});
|
||||
17
app/Database/factories/JournalTransactionsFactory.php
Normal file
17
app/Database/factories/JournalTransactionsFactory.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(App\Models\JournalTransactions::class, function (Faker $faker) {
|
||||
return [
|
||||
'transaction_group' => \Ramsey\Uuid\Uuid::uuid4()->toString(),
|
||||
'journal_id' => function () {
|
||||
return factory(App\Models\Journal::class)->create()->id;
|
||||
},
|
||||
'credit' => $faker->numberBetween(100, 10000),
|
||||
'debit' => $faker->numberBetween(100, 10000),
|
||||
'currency' => 'USD',
|
||||
'memo' => $faker->sentence(6),
|
||||
'post_date' => \Carbon\Carbon::now(),
|
||||
];
|
||||
});
|
||||
@@ -17,8 +17,8 @@ class CreateJournalTransactionsTable extends Migration
|
||||
$table->char('id', 36)->unique();
|
||||
$table->char('transaction_group', 36)->nullable();
|
||||
$table->integer('journal_id');
|
||||
$table->unsignedBigInteger('debit')->nullable();
|
||||
$table->unsignedBigInteger('credit')->nullable();
|
||||
$table->unsignedBigInteger('debit')->nullable();
|
||||
$table->char('currency', 5);
|
||||
$table->text('memo')->nullable();
|
||||
$table->char('ref_class', 32)->nullable();
|
||||
|
||||
@@ -17,9 +17,9 @@ class CreateJournalsTable extends Migration
|
||||
$table->increments('id');
|
||||
$table->unsignedInteger('ledger_id')->nullable();
|
||||
$table->bigInteger('balance')->default(0);
|
||||
$table->char('currency', 5);
|
||||
$table->char('morphed_type', 32);
|
||||
$table->integer('morphed_id');
|
||||
$table->string('currency', 5);
|
||||
$table->string('morphed_type', 32)->nullable();
|
||||
$table->unsignedInteger('morphed_id')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user