From 3c224c0f12933c6406e64e906235c8559caa2d44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20=C3=87ak=C4=B1rel?= Date: Wed, 22 Jan 2020 16:45:39 +0300 Subject: [PATCH] refs https://github.com/akaunting/akaunting/pull/1158#discussion_r369403225 --- database/seeds/SampleData.php | 57 ----------------------------------- 1 file changed, 57 deletions(-) diff --git a/database/seeds/SampleData.php b/database/seeds/SampleData.php index 359cde306..5cedc18d8 100755 --- a/database/seeds/SampleData.php +++ b/database/seeds/SampleData.php @@ -3,14 +3,7 @@ namespace Database\Seeds; use App\Abstracts\Model; -use App\Jobs\Banking\CreateAccount; -use App\Jobs\Banking\CreateDocumentTransaction; -use App\Jobs\Common\CreateContact; -use App\Jobs\Common\CreateItem; -use App\Jobs\Purchase\CreateBill; -use App\Jobs\Sale\CreateInvoice; use App\Models\Banking\Account; -use App\Models\Banking\Transaction; use App\Models\Common\Contact; use App\Models\Common\Item; use App\Models\Purchase\Bill; @@ -32,8 +25,6 @@ class SampleData extends Seeder { Model::reguard(); - $faker = Factory::create(); - $count = $this->command->option('count'); factory(Contact::class, (int)$count)->create(); @@ -42,54 +33,6 @@ class SampleData extends Seeder factory(Bill::class, (int)$count)->create(); factory(Invoice::class, (int)$count)->create(); - for ($i = 0; $i < $count; $i++) { - $amount = $faker->randomFloat(2, 1, 1000); - $invoices = Invoice::where('status', 'sent')->get(); - - if (0 === $invoices->count()) { - continue; - } - - $invoice = $invoices->random(1)->first(); - - $this->dispatch( - new CreateDocumentTransaction( - $invoice, - factory(Transaction::class)->state('income')->raw( - [ - 'contact_id' => $invoice->contact_id, - 'document_id' => $invoice->id, - 'amount' => $amount > $invoice->amount ? $invoice->amount : $amount, - ] - ) - ) - ); - } - - for ($i = 0; $i < $count; $i++) { - $amount = $faker->randomFloat(2, 1, 1000); - $bills = Bill::where('status', 'received')->get(); - - if (0 === $bills->count()) { - continue; - } - - $bill = $bills->random(1)->first(); - - $this->dispatch( - new CreateDocumentTransaction( - $bill, - factory(Transaction::class)->state('expense')->raw( - [ - 'contact_id' => $bill->contact_id, - 'document_id' => $bill->id, - 'amount' => $amount > $bill->amount ? $bill->amount : $amount, - ] - ) - ) - ); - } - Model::unguard(); } }