From 211bc16a24ef90aef44d9eff9cc265c276298a51 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 9 Jul 2017 20:38:24 +0300 Subject: [PATCH] Create more initial test data --- app/Console/Commands/CreateTestData.php | 49 +++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/app/Console/Commands/CreateTestData.php b/app/Console/Commands/CreateTestData.php index 93b1342063..80d85501fa 100644 --- a/app/Console/Commands/CreateTestData.php +++ b/app/Console/Commands/CreateTestData.php @@ -8,6 +8,10 @@ use App\Ninja\Repositories\ExpenseRepository; use App\Ninja\Repositories\InvoiceRepository; use App\Ninja\Repositories\PaymentRepository; use App\Ninja\Repositories\VendorRepository; +use App\Models\Client; +use App\Models\TaxRate; +use App\Models\Project; +use App\Models\ExpenseCategory; use Auth; use Faker\Factory; use Illuminate\Console\Command; @@ -94,6 +98,7 @@ class CreateTestData extends Command $this->createClients(); $this->createVendors(); + $this->createOtherObjects(); $this->info('Done'); } @@ -210,6 +215,50 @@ class CreateTestData extends Command } } + private function createOtherObjects() + { + $this->createTaxRate('Tax 1', 10, 1); + $this->createTaxRate('Tax 2', 20, 2); + + $this->createCategory('Category 1', 1); + $this->createCategory('Category 1', 2); + + $this->createProject('Project 1', 1); + $this->createProject('Project 2', 2); + } + + private function createTaxRate($name, $rate, $publicId) + { + $taxRate = new TaxRate(); + $taxRate->name = $name; + $taxRate->rate = $rate; + $taxRate->account_id = 1; + $taxRate->user_id = 1; + $taxRate->public_id = $publicId; + $taxRate->save(); + } + + private function createCategory($name, $publicId) + { + $category = new ExpenseCategory(); + $category->name = $name; + $category->account_id = 1; + $category->user_id = 1; + $category->public_id = $publicId; + $category->save(); + } + + private function createProject($name, $publicId) + { + $project = new Project(); + $project->name = $name; + $project->account_id = 1; + $project->client_id = 1; + $project->user_id = 1; + $project->public_id = $publicId; + $project->save(); + } + /** * @return array */