From 3432ce26b8251952dd8bf07b84a5a7bc6306a95e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Thu, 15 Oct 2020 00:08:41 +0300 Subject: [PATCH] formatting --- database/factories/Account.php | 24 +++++------ database/factories/Bill.php | 56 ++++++++++---------------- database/factories/Category.php | 48 +++++++++------------- database/factories/Contact.php | 32 ++++++--------- database/factories/Currency.php | 16 +++----- database/factories/Dashboard.php | 24 +++++------ database/factories/Invoice.php | 64 +++++++++++------------------- database/factories/Item.php | 16 +++----- database/factories/Role.php | 18 ++++----- database/factories/Tax.php | 56 ++++++++++---------------- database/factories/Transaction.php | 20 ++++------ database/factories/User.php | 16 +++----- 12 files changed, 148 insertions(+), 242 deletions(-) diff --git a/database/factories/Account.php b/database/factories/Account.php index 0a5417e55..a4e08eac6 100644 --- a/database/factories/Account.php +++ b/database/factories/Account.php @@ -41,11 +41,9 @@ class Account extends Factory */ public function enabled() { - return $this->state(function (array $attributes) { - return [ - 'enabled' => 1, - ]; - }); + return $this->state([ + 'enabled' => 1, + ]); } /** @@ -55,11 +53,9 @@ class Account extends Factory */ public function disabled() { - return $this->state(function (array $attributes) { - return [ - 'enabled' => 0, - ]; - }); + return $this->state([ + 'enabled' => 0, + ]); } /** @@ -69,10 +65,8 @@ class Account extends Factory */ public function default_currency() { - return $this->state(function (array $attributes) { - return [ - 'currency_code' => setting('default.currency'), - ]; - }); + return $this->state([ + 'currency_code' => setting('default.currency'), + ]); } } diff --git a/database/factories/Bill.php b/database/factories/Bill.php index 4ea921872..c8fc92578 100644 --- a/database/factories/Bill.php +++ b/database/factories/Bill.php @@ -70,11 +70,9 @@ class Bill extends Factory */ public function draft() { - return $this->state(function (array $attributes) { - return [ - 'status' => 'draft', - ]; - }); + return $this->state([ + 'status' => 'draft', + ]); } /** @@ -84,11 +82,9 @@ class Bill extends Factory */ public function received() { - return $this->state(function (array $attributes) { - return [ - 'status' => 'received', - ]; - }); + return $this->state([ + 'status' => 'received', + ]); } /** @@ -98,11 +94,9 @@ class Bill extends Factory */ public function partial() { - return $this->state(function (array $attributes) { - return [ - 'status' => 'partial', - ]; - }); + return $this->state([ + 'status' => 'partial', + ]); } /** @@ -112,11 +106,9 @@ class Bill extends Factory */ public function paid() { - return $this->state(function (array $attributes) { - return [ - 'status' => 'paid', - ]; - }); + return $this->state([ + 'status' => 'paid', + ]); } /** @@ -126,11 +118,9 @@ class Bill extends Factory */ public function cancelled() { - return $this->state(function (array $attributes) { - return [ - 'status' => 'cancelled', - ]; - }); + return $this->state([ + 'status' => 'cancelled', + ]); } /** @@ -140,16 +130,12 @@ class Bill extends Factory */ public function recurring() { - return $this->state(function (array $attributes) { - $frequencies = ['monthly', 'weekly']; - - return [ - 'recurring_frequency' => 'yes', - 'recurring_interval' => '1', - 'recurring_custom_frequency' => $this->faker->randomElement($frequencies), - 'recurring_count' => '1', - ]; - }); + return $this->state([ + 'recurring_frequency' => 'yes', + 'recurring_interval' => '1', + 'recurring_custom_frequency' => $this->faker->randomElement(['monthly', 'weekly']), + 'recurring_count' => '1', + ]); } /** diff --git a/database/factories/Category.php b/database/factories/Category.php index 4dc1882c7..b9d86ea64 100644 --- a/database/factories/Category.php +++ b/database/factories/Category.php @@ -39,11 +39,9 @@ class Category extends Factory */ public function enabled() { - return $this->state(function (array $attributes) { - return [ - 'enabled' => 1, - ]; - }); + return $this->state([ + 'enabled' => 1, + ]); } /** @@ -53,11 +51,9 @@ class Category extends Factory */ public function disabled() { - return $this->state(function (array $attributes) { - return [ - 'enabled' => 0, - ]; - }); + return $this->state([ + 'enabled' => 0, + ]); } /** @@ -67,11 +63,9 @@ class Category extends Factory */ public function income() { - return $this->state(function (array $attributes) { - return [ - 'type' => 'income', - ]; - }); + return $this->state([ + 'type' => 'income', + ]); } /** @@ -81,11 +75,9 @@ class Category extends Factory */ public function expense() { - return $this->state(function (array $attributes) { - return [ - 'type' => 'expense', - ]; - }); + return $this->state([ + 'type' => 'expense', + ]); } /** @@ -95,11 +87,9 @@ class Category extends Factory */ public function item() { - return $this->state(function (array $attributes) { - return [ - 'type' => 'item', - ]; - }); + return $this->state([ + 'type' => 'item', + ]); } /** @@ -109,10 +99,8 @@ class Category extends Factory */ public function other() { - return $this->state(function (array $attributes) { - return [ - 'type' => 'other', - ]; - }); + return $this->state([ + 'type' => 'other', + ]); } } diff --git a/database/factories/Contact.php b/database/factories/Contact.php index 3d194e131..2cd55e2d1 100644 --- a/database/factories/Contact.php +++ b/database/factories/Contact.php @@ -49,11 +49,9 @@ class Contact extends Factory */ public function enabled() { - return $this->state(function (array $attributes) { - return [ - 'enabled' => 1, - ]; - }); + return $this->state([ + 'enabled' => 1, + ]); } /** @@ -63,11 +61,9 @@ class Contact extends Factory */ public function disabled() { - return $this->state(function (array $attributes) { - return [ - 'enabled' => 0, - ]; - }); + return $this->state([ + 'enabled' => 0, + ]); } /** @@ -77,11 +73,9 @@ class Contact extends Factory */ public function customer() { - return $this->state(function (array $attributes) { - return [ - 'type' => 'customer', - ]; - }); + return $this->state([ + 'type' => 'customer', + ]); } /** @@ -91,10 +85,8 @@ class Contact extends Factory */ public function vendor() { - return $this->state(function (array $attributes) { - return [ - 'type' => 'vendor', - ]; - }); + return $this->state([ + 'type' => 'vendor', + ]); } } diff --git a/database/factories/Currency.php b/database/factories/Currency.php index 07c187b3e..d998cf2ea 100644 --- a/database/factories/Currency.php +++ b/database/factories/Currency.php @@ -57,11 +57,9 @@ class Currency extends Factory */ public function enabled() { - return $this->state(function (array $attributes) { - return [ - 'enabled' => 1, - ]; - }); + return $this->state([ + 'enabled' => 1, + ]); } /** @@ -71,10 +69,8 @@ class Currency extends Factory */ public function disabled() { - return $this->state(function (array $attributes) { - return [ - 'enabled' => 0, - ]; - }); + return $this->state([ + 'enabled' => 0, + ]); } } diff --git a/database/factories/Dashboard.php b/database/factories/Dashboard.php index 70e715e90..a10f1b6a0 100644 --- a/database/factories/Dashboard.php +++ b/database/factories/Dashboard.php @@ -35,11 +35,9 @@ class Dashboard extends Factory */ public function enabled() { - return $this->state(function (array $attributes) { - return [ - 'enabled' => 1, - ]; - }); + return $this->state([ + 'enabled' => 1, + ]); } /** @@ -49,11 +47,9 @@ class Dashboard extends Factory */ public function disabled() { - return $this->state(function (array $attributes) { - return [ - 'enabled' => 0, - ]; - }); + return $this->state([ + 'enabled' => 0, + ]); } /** @@ -63,11 +59,9 @@ class Dashboard extends Factory */ public function users() { - return $this->state(function (array $attributes) { - return [ - 'users' => $this->getCompanyUsers(), - ]; - }); + return $this->state([ + 'users' => $this->getCompanyUsers(), + ]); } /** diff --git a/database/factories/Invoice.php b/database/factories/Invoice.php index 6717323b3..38a1accde 100644 --- a/database/factories/Invoice.php +++ b/database/factories/Invoice.php @@ -71,11 +71,9 @@ class Invoice extends Factory */ public function draft() { - return $this->state(function (array $attributes) { - return [ - 'status' => 'draft', - ]; - }); + return $this->state([ + 'status' => 'draft', + ]); } /** @@ -85,11 +83,9 @@ class Invoice extends Factory */ public function sent() { - return $this->state(function (array $attributes) { - return [ - 'status' => 'sent', - ]; - }); + return $this->state([ + 'status' => 'sent', + ]); } /** @@ -99,11 +95,9 @@ class Invoice extends Factory */ public function viewed() { - return $this->state(function (array $attributes) { - return [ - 'status' => 'viewed', - ]; - }); + return $this->state([ + 'status' => 'viewed', + ]); } /** @@ -113,11 +107,9 @@ class Invoice extends Factory */ public function partial() { - return $this->state(function (array $attributes) { - return [ - 'status' => 'partial', - ]; - }); + return $this->state([ + 'status' => 'partial', + ]); } /** @@ -127,11 +119,9 @@ class Invoice extends Factory */ public function paid() { - return $this->state(function (array $attributes) { - return [ - 'status' => 'paid', - ]; - }); + return $this->state([ + 'status' => 'paid', + ]); } /** @@ -141,11 +131,9 @@ class Invoice extends Factory */ public function cancelled() { - return $this->state(function (array $attributes) { - return [ - 'status' => 'cancelled', - ]; - }); + return $this->state([ + 'status' => 'cancelled', + ]); } /** @@ -155,16 +143,12 @@ class Invoice extends Factory */ public function recurring() { - return $this->state(function (array $attributes) { - $frequencies = ['monthly', 'weekly']; - - return [ - 'recurring_frequency' => 'yes', - 'recurring_interval' => '1', - 'recurring_custom_frequency' => $this->faker->randomElement($frequencies), - 'recurring_count' => '1', - ]; - }); + return $this->state([ + 'recurring_frequency' => 'yes', + 'recurring_interval' => '1', + 'recurring_custom_frequency' => $this->faker->randomElement(['monthly', 'weekly']), + 'recurring_count' => '1', + ]); } /** diff --git a/database/factories/Item.php b/database/factories/Item.php index f940cba0b..1d45d964a 100644 --- a/database/factories/Item.php +++ b/database/factories/Item.php @@ -40,11 +40,9 @@ class Item extends Factory */ public function enabled() { - return $this->state(function (array $attributes) { - return [ - 'enabled' => 1, - ]; - }); + return $this->state([ + 'enabled' => 1, + ]); } /** @@ -54,10 +52,8 @@ class Item extends Factory */ public function disabled() { - return $this->state(function (array $attributes) { - return [ - 'enabled' => 0, - ]; - }); + return $this->state([ + 'enabled' => 0, + ]); } } diff --git a/database/factories/Role.php b/database/factories/Role.php index 40c9e5d90..efcf0c881 100644 --- a/database/factories/Role.php +++ b/database/factories/Role.php @@ -38,16 +38,9 @@ class Role extends Factory */ public function permissions() { - return $this->state(function (array $attributes) { - return [ - 'permissions' => $this->getPermissions(), - ]; - }); - } - - protected function getPermissions() - { - return Permission::take(50)->pluck('id')->toArray(); + return $this->state([ + 'permissions' => $this->getPermissions(), + ]); } /** @@ -61,4 +54,9 @@ class Role extends Factory $role->permissions()->attach($this->getPermissions()); }); } + + protected function getPermissions() + { + return Permission::take(50)->pluck('id')->toArray(); + } } diff --git a/database/factories/Tax.php b/database/factories/Tax.php index 5e108b66f..09f952267 100644 --- a/database/factories/Tax.php +++ b/database/factories/Tax.php @@ -39,11 +39,9 @@ class Tax extends Factory */ public function enabled() { - return $this->state(function (array $attributes) { - return [ - 'enabled' => 1, - ]; - }); + return $this->state([ + 'enabled' => 1, + ]); } /** @@ -53,11 +51,9 @@ class Tax extends Factory */ public function disabled() { - return $this->state(function (array $attributes) { - return [ - 'enabled' => 0, - ]; - }); + return $this->state([ + 'enabled' => 0, + ]); } /** @@ -67,11 +63,9 @@ class Tax extends Factory */ public function normal() { - return $this->state(function (array $attributes) { - return [ - 'type' => 'normal', - ]; - }); + return $this->state([ + 'type' => 'normal', + ]); } /** @@ -81,11 +75,9 @@ class Tax extends Factory */ public function inclusive() { - return $this->state(function (array $attributes) { - return [ - 'type' => 'inclusive', - ]; - }); + return $this->state([ + 'type' => 'inclusive', + ]); } /** @@ -95,11 +87,9 @@ class Tax extends Factory */ public function compound() { - return $this->state(function (array $attributes) { - return [ - 'type' => 'compound', - ]; - }); + return $this->state([ + 'type' => 'compound', + ]); } /** @@ -109,11 +99,9 @@ class Tax extends Factory */ public function fixed() { - return $this->state(function (array $attributes) { - return [ - 'type' => 'fixed', - ]; - }); + return $this->state([ + 'type' => 'fixed', + ]); } /** @@ -123,10 +111,8 @@ class Tax extends Factory */ public function withholding() { - return $this->state(function (array $attributes) { - return [ - 'type' => 'withholding', - ]; - }); + return $this->state([ + 'type' => 'withholding', + ]); } } diff --git a/database/factories/Transaction.php b/database/factories/Transaction.php index 5dabed3eb..91335775e 100644 --- a/database/factories/Transaction.php +++ b/database/factories/Transaction.php @@ -49,12 +49,10 @@ class Transaction extends Factory */ public function income() { - return $this->state(function (array $attributes) { - return [ - 'type' => 'income', - 'category_id' => $this->company->categories()->income()->get()->random(1)->pluck('id')->first(), - ]; - }); + return $this->state([ + 'type' => 'income', + 'category_id' => $this->company->categories()->income()->get()->random(1)->pluck('id')->first(), + ]); } /** @@ -64,11 +62,9 @@ class Transaction extends Factory */ public function expense() { - return $this->state(function (array $attributes) { - return [ - 'type' => 'expense', - 'category_id' => $this->company->categories()->expense()->get()->random(1)->pluck('id')->first(), - ]; - }); + return $this->state([ + 'type' => 'expense', + 'category_id' => $this->company->categories()->expense()->get()->random(1)->pluck('id')->first(), + ]); } } diff --git a/database/factories/User.php b/database/factories/User.php index ae4c61f6b..8e04141bb 100644 --- a/database/factories/User.php +++ b/database/factories/User.php @@ -44,11 +44,9 @@ class User extends Factory */ public function enabled() { - return $this->state(function (array $attributes) { - return [ - 'enabled' => 1, - ]; - }); + return $this->state([ + 'enabled' => 1, + ]); } /** @@ -58,10 +56,8 @@ class User extends Factory */ public function disabled() { - return $this->state(function (array $attributes) { - return [ - 'enabled' => 0, - ]; - }); + return $this->state([ + 'enabled' => 0, + ]); } }