Changed foreign key id field name in person_targets and account_classes from
'io_type' to 'io_type_id'. Implemented PersonTarget factory.
This commit is contained in:
@@ -1,9 +1,17 @@
|
||||
<?php
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use Carbon\Carbon;
|
||||
|
||||
use App\IOType;
|
||||
|
||||
$factory->define(App\PersonTarget::class, function (Faker $faker) {
|
||||
return [
|
||||
//
|
||||
'io_type_id' => IOType::all('id')->random()->id,
|
||||
'date' => $faker->dateTimeInInterval('2014-04-01'),
|
||||
'amount' => $faker->randomFloat(2, 10, 2000),
|
||||
'reference' => $faker->text(20),
|
||||
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
'updated_at' => Carbon::now()->format('Y-m-d H:i:s')
|
||||
];
|
||||
});
|
||||
|
||||
@@ -31,8 +31,8 @@ class CreatePersonTargetsTable extends Migration
|
||||
// The type of the target. It can be either a payable or a
|
||||
// receivable. A payable is of type 'expediture' and a receivable is
|
||||
// of type 'income'.
|
||||
$table->integer('io_type')->unsigned();
|
||||
$table->foreign('io_type')->references('id')->on('i_o_types')
|
||||
$table->integer('io_type_id')->unsigned();
|
||||
$table->foreign('io_type_id')->references('id')->on('i_o_types')
|
||||
->onDelete('no action');
|
||||
|
||||
// A reference text which describes the target
|
||||
|
||||
@@ -23,8 +23,8 @@ class CreateAccountClassesTable extends Migration
|
||||
$table->smallInteger('number')->unsigned()->unique();
|
||||
|
||||
// The type of the account class.
|
||||
$table->integer('io_type')->unsigned();
|
||||
$table->foreign('io_type')->references('id')->on('i_o_types')
|
||||
$table->integer('io_type_id')->unsigned();
|
||||
$table->foreign('io_type_id')->references('id')->on('i_o_types')
|
||||
->onDelete('no action');
|
||||
|
||||
// The scope of the account class.
|
||||
|
||||
@@ -15,7 +15,7 @@ class AccountClassesTableSeeder extends Seeder
|
||||
DB::table('account_classes')->insert([
|
||||
[
|
||||
'scope_id' => 1,
|
||||
'io_type' => 1,
|
||||
'io_type_id' => 1,
|
||||
'number' => 1000,
|
||||
'name' => 'EINNAHMEN',
|
||||
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
@@ -23,7 +23,7 @@ class AccountClassesTableSeeder extends Seeder
|
||||
],
|
||||
[
|
||||
'scope_id' => 1,
|
||||
'io_type' => 2,
|
||||
'io_type_id' => 2,
|
||||
'number' => 1500,
|
||||
'name' => 'AUSGABEN',
|
||||
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
@@ -31,7 +31,7 @@ class AccountClassesTableSeeder extends Seeder
|
||||
],
|
||||
[
|
||||
'scope_id' => 2,
|
||||
'io_type' => 1,
|
||||
'io_type_id' => 1,
|
||||
'number' => 2000,
|
||||
'name' => 'EINNAHMEN',
|
||||
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
@@ -39,7 +39,7 @@ class AccountClassesTableSeeder extends Seeder
|
||||
],
|
||||
[
|
||||
'scope_id' => 2,
|
||||
'io_type' => 2,
|
||||
'io_type_id' => 2,
|
||||
'number' => 2500,
|
||||
'name' => 'AUSGABEN',
|
||||
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
@@ -47,7 +47,7 @@ class AccountClassesTableSeeder extends Seeder
|
||||
],
|
||||
[
|
||||
'scope_id' => 3,
|
||||
'io_type' => 1,
|
||||
'io_type_id' => 1,
|
||||
'number' => 3000,
|
||||
'name' => 'EINNAHMEN',
|
||||
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
@@ -55,7 +55,7 @@ class AccountClassesTableSeeder extends Seeder
|
||||
],
|
||||
[
|
||||
'scope_id' => 3,
|
||||
'io_type' => 2,
|
||||
'io_type_id' => 2,
|
||||
'number' => 3500,
|
||||
'name' => 'AUSGABEN',
|
||||
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
@@ -63,7 +63,7 @@ class AccountClassesTableSeeder extends Seeder
|
||||
],
|
||||
[
|
||||
'scope_id' => 4,
|
||||
'io_type' => 1,
|
||||
'io_type_id' => 1,
|
||||
'number' => 4000,
|
||||
'name' => 'EINNAHMEN',
|
||||
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
@@ -71,7 +71,7 @@ class AccountClassesTableSeeder extends Seeder
|
||||
],
|
||||
[
|
||||
'scope_id' => 4,
|
||||
'io_type' => 2,
|
||||
'io_type_id' => 2,
|
||||
'number' => 4500,
|
||||
'name' => 'AUSGABEN',
|
||||
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
@@ -79,7 +79,7 @@ class AccountClassesTableSeeder extends Seeder
|
||||
],
|
||||
[
|
||||
'scope_id' => 5,
|
||||
'io_type' => 1,
|
||||
'io_type_id' => 1,
|
||||
'number' => 5000,
|
||||
'name' => 'EINNAHMEN',
|
||||
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
@@ -87,7 +87,7 @@ class AccountClassesTableSeeder extends Seeder
|
||||
],
|
||||
[
|
||||
'scope_id' => 5,
|
||||
'io_type' => 2,
|
||||
'io_type_id' => 2,
|
||||
'number' => 5500,
|
||||
'name' => 'AUSGABEN',
|
||||
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
|
||||
Reference in New Issue
Block a user