mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Even more code cleanup.
This commit is contained in:
parent
80c1184eac
commit
41562f8f6d
@ -1,14 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateUsersTable
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class CreateUsersTable extends Migration {
|
||||
class CreateUsersTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
@ -17,8 +18,8 @@ class CreateUsersTable extends Migration {
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('users', function(Blueprint $table)
|
||||
{
|
||||
Schema::create(
|
||||
'users', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->string('email', 100);
|
||||
@ -28,7 +29,8 @@ class CreateUsersTable extends Migration {
|
||||
$table->boolean('migrated');
|
||||
|
||||
$table->unique('email');
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,14 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateAccountsTable
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class CreateAccountsTable extends Migration {
|
||||
class CreateAccountsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
@ -17,8 +18,8 @@ class CreateAccountsTable extends Migration {
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('accounts', function(Blueprint $table)
|
||||
{
|
||||
Schema::create(
|
||||
'accounts', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('user_id')->unsigned();
|
||||
@ -37,7 +38,8 @@ class CreateAccountsTable extends Migration {
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->unique(['user_id', 'account_type_id', 'name']);
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,14 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateComponentsTable
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class CreateComponentsTable extends Migration {
|
||||
class CreateComponentsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
@ -17,8 +18,8 @@ class CreateComponentsTable extends Migration {
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('components', function(Blueprint $table)
|
||||
{
|
||||
Schema::create(
|
||||
'components', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->string('name', 50);
|
||||
@ -31,7 +32,8 @@ class CreateComponentsTable extends Migration {
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->unique(['user_id', 'class', 'name']);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateTransactionCurrenciesTable
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class CreateTransactionCurrenciesTable extends Migration {
|
||||
class CreateTransactionCurrenciesTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
@ -17,12 +18,13 @@ class CreateTransactionCurrenciesTable extends Migration {
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('transaction_currencies', function(Blueprint $table)
|
||||
{
|
||||
Schema::create(
|
||||
'transaction_currencies', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->string('code', 3);
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,14 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateTransactionTypesTable
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class CreateTransactionTypesTable extends Migration {
|
||||
class CreateTransactionTypesTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
@ -17,12 +18,13 @@ class CreateTransactionTypesTable extends Migration {
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('transaction_types', function(Blueprint $table)
|
||||
{
|
||||
Schema::create(
|
||||
'transaction_types', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->string('type', 50);
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,14 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateTransactionJournalsTable
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class CreateTransactionJournalsTable extends Migration {
|
||||
class CreateTransactionJournalsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
@ -17,8 +18,8 @@ class CreateTransactionJournalsTable extends Migration {
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('transaction_journals', function(Blueprint $table)
|
||||
{
|
||||
Schema::create(
|
||||
'transaction_journals', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('user_id')->unsigned();
|
||||
@ -42,7 +43,8 @@ class CreateTransactionJournalsTable extends Migration {
|
||||
$table->foreign('user_id')
|
||||
->references('id')->on('users')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,14 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateComponentTransactionTable
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class CreateComponentTransactionTable extends Migration {
|
||||
class CreateComponentTransactionTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
@ -17,8 +18,8 @@ class CreateComponentTransactionTable extends Migration {
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('component_transaction', function(Blueprint $table)
|
||||
{
|
||||
Schema::create(
|
||||
'component_transaction', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('component_id')->unsigned();
|
||||
$table->integer('transaction_id')->unsigned();
|
||||
@ -32,7 +33,8 @@ class CreateComponentTransactionTable extends Migration {
|
||||
$table->foreign('transaction_id')
|
||||
->references('id')->on('transactions')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,14 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateRecurringTransactionsTable
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class CreateRecurringTransactionsTable extends Migration {
|
||||
class CreateRecurringTransactionsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
@ -17,8 +18,8 @@ class CreateRecurringTransactionsTable extends Migration {
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('recurring_transactions', function(Blueprint $table)
|
||||
{
|
||||
Schema::create(
|
||||
'recurring_transactions', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('user_id')->unsigned();
|
||||
@ -36,7 +37,8 @@ class CreateRecurringTransactionsTable extends Migration {
|
||||
$table->unique(['user_id', 'name']);
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,14 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateComponentTransactionJournalTable
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class CreateComponentTransactionJournalTable extends Migration {
|
||||
class CreateComponentTransactionJournalTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
@ -17,8 +18,8 @@ class CreateComponentTransactionJournalTable extends Migration {
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('component_transaction_journal', function(Blueprint $table)
|
||||
{
|
||||
Schema::create(
|
||||
'component_transaction_journal', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('component_id')->unsigned();
|
||||
$table->integer('transaction_journal_id')->unsigned();
|
||||
@ -32,7 +33,8 @@ class CreateComponentTransactionJournalTable extends Migration {
|
||||
$table->foreign('transaction_journal_id')
|
||||
->references('id')->on('transaction_journals')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -7,7 +7,8 @@ use Illuminate\Database\Migrations\Migration;
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class CreateSessionTable extends Migration {
|
||||
class CreateSessionTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
@ -16,12 +17,13 @@ class CreateSessionTable extends Migration {
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('sessions', function($t)
|
||||
{
|
||||
Schema::create(
|
||||
'sessions', function ($t) {
|
||||
$t->string('id')->unique();
|
||||
$t->text('payload');
|
||||
$t->integer('last_activity');
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,14 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateLimitsTable
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class CreateLimitsTable extends Migration {
|
||||
class CreateLimitsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
@ -17,8 +18,8 @@ class CreateLimitsTable extends Migration {
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('limits', function(Blueprint $table)
|
||||
{
|
||||
Schema::create(
|
||||
'limits', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('component_id')->unsigned();
|
||||
@ -33,7 +34,8 @@ class CreateLimitsTable extends Migration {
|
||||
$table->foreign('component_id')
|
||||
->references('id')->on('components')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,14 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateLimitRepeatTable
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class CreateLimitRepeatTable extends Migration {
|
||||
class CreateLimitRepeatTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
@ -17,8 +18,8 @@ class CreateLimitRepeatTable extends Migration {
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('limit_repetitions', function(Blueprint $table)
|
||||
{
|
||||
Schema::create(
|
||||
'limit_repetitions', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('limit_id')->unsigned();
|
||||
@ -32,7 +33,8 @@ class CreateLimitRepeatTable extends Migration {
|
||||
$table->foreign('limit_id')
|
||||
->references('id')->on('limits')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,14 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class RecurringTransactionsToComponents
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ShortMethodName)
|
||||
*/
|
||||
class RecurringTransactionsToComponents extends Migration {
|
||||
class RecurringTransactionsToComponents extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
@ -17,8 +18,8 @@ class RecurringTransactionsToComponents extends Migration {
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('component_recurring_transaction', function(Blueprint $table)
|
||||
{
|
||||
Schema::create(
|
||||
'component_recurring_transaction', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('component_id')->unsigned();
|
||||
$table->integer('recurring_transaction_id')->unsigned();
|
||||
@ -33,7 +34,8 @@ class RecurringTransactionsToComponents extends Migration {
|
||||
$table->foreign('recurring_transaction_id')
|
||||
->references('id')->on('recurring_transactions')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,9 +27,6 @@ class Chart implements ChartInterface
|
||||
$return = ['name' => $account->name, 'id' => $account->id, 'data' => []];
|
||||
|
||||
while ($current <= $end) {
|
||||
\Log::debug(
|
||||
'Now at day: ' . $current . '(' . $current->timestamp . '), (' . ($current->timestamp * 1000) . ') '
|
||||
);
|
||||
if ($current > $today) {
|
||||
$return['data'][] = [$current->timestamp * 1000, $account->predict(clone $current)];
|
||||
} else {
|
||||
@ -118,9 +115,6 @@ class Chart implements ChartInterface
|
||||
}]
|
||||
)->orderBy('name', 'ASC')->get();
|
||||
|
||||
$limitInPeriod = 'Envelope for (empty)';
|
||||
$spentInPeriod = 'Spent in (empty)';
|
||||
|
||||
foreach ($budgets as $budget) {
|
||||
$budget->count = 0;
|
||||
foreach ($budget->limits as $limit) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace Firefly\Helper\Form;
|
||||
|
||||
use Illuminate\Events\Dispatcher;
|
||||
|
||||
/**
|
||||
* Class FormTrigger
|
||||
*
|
||||
|
@ -142,6 +142,7 @@ class MigrationHelper implements MigrationHelperInterface
|
||||
foreach ($this->JSON->components as $entry) {
|
||||
switch ($entry->type->type) {
|
||||
case 'beneficiary':
|
||||
/** @noinspection PhpParamsInspection */
|
||||
$beneficiary = $this->_importBeneficiary($entry, $beneficiaryAT);
|
||||
$this->map['accounts'][$entry->id] = $beneficiary;
|
||||
break;
|
||||
|
@ -62,6 +62,8 @@ class EloquentAccountRepository implements AccountRepositoryInterface
|
||||
}
|
||||
$type = \AccountType::where('description', 'Beneficiary account')->first();
|
||||
|
||||
/** @noinspection PhpParamsInspection */
|
||||
|
||||
return $this->createOrFind($name, $type);
|
||||
}
|
||||
|
||||
|
@ -141,6 +141,7 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
|
||||
|
||||
return $journal;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $journalId
|
||||
*
|
||||
|
@ -62,16 +62,6 @@ class Account extends Ardent
|
||||
return $this->belongsTo('AccountType');
|
||||
}
|
||||
|
||||
/**
|
||||
* User
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('User');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an accounts current balance.
|
||||
*
|
||||
@ -92,16 +82,6 @@ class Account extends Ardent
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Carbon\Carbon $date
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function predict(\Carbon\Carbon $date)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transactions.
|
||||
*
|
||||
@ -112,4 +92,26 @@ class Account extends Ardent
|
||||
return $this->hasMany('Transaction');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Carbon\Carbon $date
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function predict(
|
||||
/** @noinspection PhpUnusedParameterInspection */
|
||||
\Carbon\Carbon $date
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* User
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('User');
|
||||
}
|
||||
|
||||
}
|
@ -14,8 +14,10 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
|
||||
*/
|
||||
public function createApplication()
|
||||
{
|
||||
/** @noinspection PhpUnusedLocalVariableInspection */
|
||||
$unitTesting = true;
|
||||
|
||||
/** @noinspection PhpUnusedLocalVariableInspection */
|
||||
$testEnvironment = 'testing';
|
||||
|
||||
return require __DIR__ . '/../../bootstrap/start.php';
|
||||
|
Loading…
Reference in New Issue
Block a user