Code cleanup.

This commit is contained in:
James Cole
2017-11-22 21:12:27 +01:00
parent 4e6b782204
commit 781ca052d8
142 changed files with 213 additions and 859 deletions

View File

@@ -29,10 +29,10 @@ $factory->define(
static $password;
return [
'email' => $faker->safeEmail,
'password' => $password ?: $password = bcrypt('secret'),
'remember_token' => str_random(10),
];
'email' => $faker->safeEmail,
'password' => $password ?: $password = bcrypt('secret'),
'remember_token' => str_random(10),
];
}
);
@@ -40,13 +40,13 @@ $factory->define(
FireflyIII\Models\CurrencyExchangeRate::class,
function (Faker\Generator $faker) {
return [
'user_id' => 1,
'from_currency_id' => 1,
'to_currency_id' => 2,
'date' => '2017-01-01',
'rate' => '1.5',
'user_rate' => null,
];
'user_id' => 1,
'from_currency_id' => 1,
'to_currency_id' => 2,
'date' => '2017-01-01',
'rate' => '1.5',
'user_rate' => null,
];
}
);
@@ -54,10 +54,10 @@ $factory->define(
FireflyIII\Models\TransactionCurrency::class,
function (Faker\Generator $faker) {
return [
'name' => $faker->words(1, true),
'code' => 'ABC',
'symbol' => 'x',
];
'name' => $faker->words(1, true),
'code' => 'ABC',
'symbol' => 'x',
];
}
);
@@ -65,44 +65,43 @@ $factory->define(
FireflyIII\Models\ImportJob::class,
function (Faker\Generator $faker) {
return [
'id' => $faker->numberBetween(1, 100),
'user_id' => 1,
'key' => $faker->words(1, true),
'file_type' => 'csv',
'status' => 'import_status_never_started',
'configuration' => null,
'extended_status' => [
'total_steps' => 0,
'steps_done' => 0,
'import_count' => 0,
'importTag' => 0,
'errors' => [],
],
];
'id' => $faker->numberBetween(1, 100),
'user_id' => 1,
'key' => $faker->words(1, true),
'file_type' => 'csv',
'status' => 'import_status_never_started',
'configuration' => null,
'extended_status' => [
'total_steps' => 0,
'steps_done' => 0,
'import_count' => 0,
'importTag' => 0,
'errors' => [],
],
];
}
);
$factory->define(
FireflyIII\Models\TransactionJournal::class,
function (Faker\Generator $faker) {
return [
'id' => $faker->unique()->numberBetween(1000, 10000),
'user_id' => 1,
'transaction_type_id' => 1,
'bill_id' => null,
// TODO update this transaction currency reference.
'transaction_currency_id' => 1,
'description' => $faker->words(3, true),
'date' => '2017-01-01',
'interest_date' => null,
'book_date' => null,
'process_date' => null,
'order' => 0,
'tag_count' => 0,
'encrypted' => 0,
'completed' => 1,
];
'id' => $faker->unique()->numberBetween(1000, 10000),
'user_id' => 1,
'transaction_type_id' => 1,
'bill_id' => null,
// TODO update this transaction currency reference.
'transaction_currency_id' => 1,
'description' => $faker->words(3, true),
'date' => '2017-01-01',
'interest_date' => null,
'book_date' => null,
'process_date' => null,
'order' => 0,
'tag_count' => 0,
'encrypted' => 0,
'completed' => 1,
];
}
);
@@ -110,19 +109,19 @@ $factory->define(
FireflyIII\Models\Bill::class,
function (Faker\Generator $faker) {
return [
'id' => $faker->numberBetween(1, 10),
'user_id' => 1,
'name' => $faker->words(3, true),
'match' => $faker->words(3, true),
'amount_min' => '100.00',
'amount_max' => '100.00',
'date' => '2017-01-01',
'repeat_freq' => 'monthly',
'skip' => 0,
'automatch' => 1,
'name_encrypted' => 0,
'match_encrypted' => 0,
];
'id' => $faker->numberBetween(1, 10),
'user_id' => 1,
'name' => $faker->words(3, true),
'match' => $faker->words(3, true),
'amount_min' => '100.00',
'amount_max' => '100.00',
'date' => '2017-01-01',
'repeat_freq' => 'monthly',
'skip' => 0,
'automatch' => 1,
'name_encrypted' => 0,
'match_encrypted' => 0,
];
}
);
@@ -130,12 +129,12 @@ $factory->define(
FireflyIII\Models\PiggyBankRepetition::class,
function (Faker\Generator $faker) {
return [
'id' => $faker->unique()->numberBetween(100, 10000),
'piggy_bank_id' => $faker->numberBetween(1, 10),
'startdate' => '2017-01-01',
'targetdate' => '2020-01-01',
'currentamount' => 10,
];
'id' => $faker->unique()->numberBetween(100, 10000),
'piggy_bank_id' => $faker->numberBetween(1, 10),
'startdate' => '2017-01-01',
'targetdate' => '2020-01-01',
'currentamount' => 10,
];
}
);
@@ -143,15 +142,15 @@ $factory->define(
FireflyIII\Models\PiggyBank::class,
function (Faker\Generator $faker) {
return [
'id' => $faker->unique()->numberBetween(100, 10000),
'account_id' => $faker->numberBetween(1, 10),
'name' => $faker->words(3, true),
'target_amount' => '1000.00',
'startdate' => '2017-01-01',
'order' => 1,
'active' => 1,
'encrypted' => 0,
];
'id' => $faker->unique()->numberBetween(100, 10000),
'account_id' => $faker->numberBetween(1, 10),
'name' => $faker->words(3, true),
'target_amount' => '1000.00',
'startdate' => '2017-01-01',
'order' => 1,
'active' => 1,
'encrypted' => 0,
];
}
);
@@ -159,11 +158,11 @@ $factory->define(
FireflyIII\Models\Tag::class,
function (Faker\Generator $faker) {
return [
'id' => $faker->unique()->numberBetween(200, 10000),
'user_id' => 1,
'tagMode' => 'nothing',
'tag' => $faker->words(1, true),
];
'id' => $faker->unique()->numberBetween(200, 10000),
'user_id' => 1,
'tagMode' => 'nothing',
'tag' => $faker->words(1, true),
];
}
);
@@ -171,9 +170,9 @@ $factory->define(
FireflyIII\Models\Category::class,
function (Faker\Generator $faker) {
return [
'id' => $faker->numberBetween(1, 10),
'name' => $faker->words(3, true),
];
'id' => $faker->numberBetween(1, 10),
'name' => $faker->words(3, true),
];
}
);
@@ -181,9 +180,9 @@ $factory->define(
FireflyIII\Models\Budget::class,
function (Faker\Generator $faker) {
return [
'id' => $faker->numberBetween(1, 10),
'name' => $faker->words(3, true),
];
'id' => $faker->numberBetween(1, 10),
'name' => $faker->words(3, true),
];
}
);
@@ -191,12 +190,12 @@ $factory->define(
FireflyIII\Models\PiggyBankEvent::class,
function (Faker\Generator $faker) {
return [
'id' => $faker->numberBetween(1, 10),
'piggy_bank_id' => $faker->numberBetween(1, 10),
'transaction_journal_id' => $faker->numberBetween(1, 10),
'date' => $faker->date('Y-m-d'),
'amount' => '100',
];
'id' => $faker->numberBetween(1, 10),
'piggy_bank_id' => $faker->numberBetween(1, 10),
'transaction_journal_id' => $faker->numberBetween(1, 10),
'date' => $faker->date('Y-m-d'),
'amount' => '100',
];
}
);
@@ -204,13 +203,12 @@ $factory->define(
FireflyIII\Models\BudgetLimit::class,
function (Faker\Generator $faker) {
return [
'id' => $faker->numberBetween(1, 10),
'start_date' => '2017-01-01',
'end_date' => '2017-01-31',
'amount' => '300',
'budget_id' => $faker->numberBetween(1, 6),
];
'id' => $faker->numberBetween(1, 10),
'start_date' => '2017-01-01',
'end_date' => '2017-01-31',
'amount' => '300',
'budget_id' => $faker->numberBetween(1, 6),
];
}
);
@@ -218,11 +216,11 @@ $factory->define(
FireflyIII\Models\Account::class,
function (Faker\Generator $faker) {
return [
'id' => $faker->unique()->numberBetween(1000, 10000),
'name' => $faker->words(3, true),
'account_type_id' => 1,
'active' => true,
];
'id' => $faker->unique()->numberBetween(1000, 10000),
'name' => $faker->words(3, true),
'account_type_id' => 1,
'active' => true,
];
}
);
@@ -230,31 +228,31 @@ $factory->define(
FireflyIII\Models\Transaction::class,
function (Faker\Generator $faker) {
return [
'transaction_amount' => strval($faker->randomFloat(2, -100, 100)),
'destination_amount' => strval($faker->randomFloat(2, -100, 100)),
'opposing_account_id' => $faker->numberBetween(1, 10),
'source_account_id' => $faker->numberBetween(1, 10),
'opposing_account_name' => $faker->words(3, true),
'description' => $faker->words(3, true),
'source_account_name' => $faker->words(3, true),
'destination_account_id' => $faker->numberBetween(1, 10),
'date' => new Carbon,
'destination_account_name' => $faker->words(3, true),
'amount' => strval($faker->randomFloat(2, -100, 100)),
'budget_id' => 0,
'category' => $faker->words(3, true),
'transaction_journal_id' => $faker->numberBetween(1, 10),
'journal_id' => $faker->numberBetween(1, 10),
'transaction_currency_code' => 'EUR',
'transaction_type_type' => 'Withdrawal',
'account_encrypted' => 0,
'account_name' => 'Some name',
'transaction_currency_id' => 1,
'transaction_currency_symbol' => '€',
'foreign_destination_amount' => null,
'foreign_currency_id' => null,
'foreign_currency_code' => null,
'foreign_currency_symbol' => null,
];
'transaction_amount' => strval($faker->randomFloat(2, -100, 100)),
'destination_amount' => strval($faker->randomFloat(2, -100, 100)),
'opposing_account_id' => $faker->numberBetween(1, 10),
'source_account_id' => $faker->numberBetween(1, 10),
'opposing_account_name' => $faker->words(3, true),
'description' => $faker->words(3, true),
'source_account_name' => $faker->words(3, true),
'destination_account_id' => $faker->numberBetween(1, 10),
'date' => new Carbon,
'destination_account_name' => $faker->words(3, true),
'amount' => strval($faker->randomFloat(2, -100, 100)),
'budget_id' => 0,
'category' => $faker->words(3, true),
'transaction_journal_id' => $faker->numberBetween(1, 10),
'journal_id' => $faker->numberBetween(1, 10),
'transaction_currency_code' => 'EUR',
'transaction_type_type' => 'Withdrawal',
'account_encrypted' => 0,
'account_name' => 'Some name',
'transaction_currency_id' => 1,
'transaction_currency_symbol' => '€',
'foreign_destination_amount' => null,
'foreign_currency_id' => null,
'foreign_currency_code' => null,
'foreign_currency_symbol' => null,
];
}
);

View File

@@ -20,7 +20,6 @@ class CreateSupportTables extends Migration
{
/**
* Reverse the migrations.
*
*/
public function down()
{
@@ -124,8 +123,7 @@ class CreateSupportTables extends Migration
Schema::create(
'jobs',
function (Blueprint $table) {
// straight from Laravel
// straight from Laravel
$table->bigIncrements('id');
$table->string('queue');
$table->longText('payload');

View File

@@ -60,7 +60,6 @@ class CreateMainTables extends Migration
*/
public function up()
{
//
$this->createAccountTables();
$this->createPiggyBanksTable();
$this->createAttachmentsTable();
@@ -433,7 +432,6 @@ class CreateMainTables extends Migration
$table->boolean('active')->default(1);
$table->boolean('stop_processing')->default(0);
// link rule id to rules table
$table->foreign('rule_id')->references('id')->on('rules')->onDelete('cascade');
}
@@ -454,7 +452,6 @@ class CreateMainTables extends Migration
$table->boolean('active')->default(1);
$table->boolean('stop_processing')->default(0);
// link rule id to rules table
$table->foreign('rule_id')->references('id')->on('rules')->onDelete('cascade');
}
@@ -583,7 +580,6 @@ class CreateMainTables extends Migration
);
}
if (!Schema::hasTable('piggy_bank_events')) {
Schema::create(
'piggy_bank_events',

View File

@@ -23,7 +23,6 @@ class ChangesFor3101 extends Migration
*/
public function down()
{
//
}
/**

View File

@@ -18,7 +18,6 @@ use Illuminate\Database\Schema\Blueprint;
*/
class FixNullables extends Migration
{
/**
* Reverse the migrations.
*/

View File

@@ -8,7 +8,6 @@
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
@@ -24,7 +23,6 @@ class ExpandTransactionsTable extends Migration
*/
public function down()
{
//
}
/**

View File

@@ -8,7 +8,6 @@
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;

View File

@@ -8,7 +8,6 @@
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
@@ -24,7 +23,6 @@ class ChangesForV420 extends Migration
*/
public function down()
{
//
}
/**

View File

@@ -8,10 +8,8 @@
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
@@ -47,7 +45,6 @@ class ChangesForV430 extends Migration
$table->date('start_date');
$table->date('end_date');
$table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade');
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
}

View File

@@ -8,7 +8,6 @@
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
@@ -21,8 +20,6 @@ class ChangesForV431 extends Migration
{
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
@@ -40,7 +37,6 @@ class ChangesForV431 extends Migration
}
);
// remove date field "end_date"
Schema::table(
'budget_limits',

View File

@@ -8,10 +8,8 @@
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
@@ -22,8 +20,6 @@ class ChangesForV440 extends Migration
{
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
@@ -36,7 +32,6 @@ class ChangesForV440 extends Migration
* Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/
public function up()
{
@@ -60,7 +55,7 @@ class ChangesForV440 extends Migration
}
);
}
//
Schema::table(
'transactions',
function (Blueprint $table) {

View File

@@ -8,10 +8,8 @@
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
@@ -22,8 +20,6 @@ class ChangesForV450 extends Migration
{
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
@@ -33,7 +29,6 @@ class ChangesForV450 extends Migration
* Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/
public function up()
{

View File

@@ -1,6 +1,6 @@
<?php
declare(strict_types=1);
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
@@ -13,8 +13,6 @@ class ChangesForV470 extends Migration
{
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
@@ -26,7 +24,6 @@ class ChangesForV470 extends Migration
* Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/
public function up()
{
@@ -42,7 +39,7 @@ class ChangesForV470 extends Migration
$table->string('inward');
$table->boolean('editable');
$table->unique(['name', 'outward','inward']);
$table->unique(['name', 'outward', 'inward']);
}
);
}
@@ -62,7 +59,7 @@ class ChangesForV470 extends Migration
$table->foreign('source_id')->references('id')->on('transaction_journals')->onDelete('cascade');
$table->foreign('destination_id')->references('id')->on('transaction_journals')->onDelete('cascade');
$table->unique(['link_type_id','source_id','destination_id']);
$table->unique(['link_type_id', 'source_id', 'destination_id']);
}
);
}

View File

@@ -1,6 +1,6 @@
<?php
declare(strict_types=1);
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
@@ -10,19 +10,15 @@ class ChangesForV470a extends Migration
{
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
/**
* Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/
public function up()
{

View File

@@ -8,7 +8,6 @@
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
use FireflyIII\Models\AccountType;

View File

@@ -19,8 +19,6 @@ class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{

View File

@@ -7,10 +7,8 @@
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
use FireflyIII\Models\LinkType;
use Illuminate\Database\Seeder;

View File

@@ -8,10 +8,8 @@
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
use FireflyIII\Models\Role;
use Illuminate\Database\Seeder;

View File

@@ -8,7 +8,6 @@
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
use FireflyIII\Models\TransactionCurrency;
@@ -50,11 +49,5 @@ class TransactionCurrencySeeder extends Seeder
TransactionCurrency::create(['code' => 'XBT', 'name' => 'Bitcoin', 'symbol' => '₿', 'decimal_places' => 8]);
TransactionCurrency::create(['code' => 'BCH', 'name' => 'Bitcoin cash', 'symbol' => '₿C', 'decimal_places' => 8]);
TransactionCurrency::create(['code' => 'ETH', 'name' => 'Ethereum', 'symbol' => 'Ξ', 'decimal_places' => 12]);
}
}

View File

@@ -8,7 +8,6 @@
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
use FireflyIII\Models\TransactionType;