- Updated transaction controller to need less code for the same work.

- Small feedback bug in migration controller
- Better database create scripts.
- Fixed bug in seed scripts.
- Cleanup and fixed sorting in various helpers
- Extended some tests to catch changed code.
- Created show(journal) and edit(journal) (untested)

[skip-ci]
This commit is contained in:
James Cole
2014-07-16 21:11:43 +02:00
parent 552224b73f
commit 12ae548dab
20 changed files with 616 additions and 237 deletions

View File

@@ -16,6 +16,7 @@ class CreateTransactionJournalsTable extends Migration {
{
$table->increments('id');
$table->timestamps();
$table->integer('user_id')->unsigned();
$table->integer('transaction_type_id')->unsigned();
$table->integer('transaction_currency_id')->unsigned();
$table->string('description',255)->nullable();
@@ -31,6 +32,11 @@ class CreateTransactionJournalsTable extends Migration {
$table->foreign('transaction_currency_id')
->references('id')->on('transaction_currencies')
->onDelete('cascade');
// connect users
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
});
}

View File

@@ -1,42 +1,49 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateTransactionsTable extends Migration {
class CreateTransactionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('transactions', function(Blueprint $table)
{
$table->increments('id');
$table->timestamps();
$table->integer('account_id')->integer();
$table->integer('transaction_journal_id')->integer()->unsigned();
$table->string('description',255)->nullable();
$table->decimal('amount',10,2);
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create(
'transactions', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->integer('account_id')->unsigned();
$table->integer('transaction_journal_id')->unsigned();
$table->string('description', 255)->nullable();
$table->decimal('amount', 10, 2);
// connect transactions to transaction journals
$table->foreign('transaction_journal_id')
->references('id')->on('transaction_journals')
->onDelete('cascade');
// connect transactions to transaction journals
$table->foreign('transaction_journal_id')
->references('id')->on('transaction_journals')
->onDelete('cascade');
});
}
// connect account id:
$table->foreign('account_id')
->references('id')->on('accounts')
->onDelete('cascade');
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('transactions');
}
}
);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('transactions');
}
}

View File

@@ -12,9 +12,10 @@ class DefaultUserSeeder extends Seeder
'password' => Hash::make('sander'),
'reset' => null,
'remember_token' => null,
'migrated' => false
'migrated' => 0
]
);
}
}