formatting

This commit is contained in:
Denis Duliçi 2020-10-15 00:08:41 +03:00
parent b83c566608
commit 3432ce26b8
12 changed files with 148 additions and 242 deletions

View File

@ -41,11 +41,9 @@ class Account extends Factory
*/ */
public function enabled() public function enabled()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'enabled' => 1,
'enabled' => 1, ]);
];
});
} }
/** /**
@ -55,11 +53,9 @@ class Account extends Factory
*/ */
public function disabled() public function disabled()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'enabled' => 0,
'enabled' => 0, ]);
];
});
} }
/** /**
@ -69,10 +65,8 @@ class Account extends Factory
*/ */
public function default_currency() public function default_currency()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'currency_code' => setting('default.currency'),
'currency_code' => setting('default.currency'), ]);
];
});
} }
} }

View File

@ -70,11 +70,9 @@ class Bill extends Factory
*/ */
public function draft() public function draft()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'status' => 'draft',
'status' => 'draft', ]);
];
});
} }
/** /**
@ -84,11 +82,9 @@ class Bill extends Factory
*/ */
public function received() public function received()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'status' => 'received',
'status' => 'received', ]);
];
});
} }
/** /**
@ -98,11 +94,9 @@ class Bill extends Factory
*/ */
public function partial() public function partial()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'status' => 'partial',
'status' => 'partial', ]);
];
});
} }
/** /**
@ -112,11 +106,9 @@ class Bill extends Factory
*/ */
public function paid() public function paid()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'status' => 'paid',
'status' => 'paid', ]);
];
});
} }
/** /**
@ -126,11 +118,9 @@ class Bill extends Factory
*/ */
public function cancelled() public function cancelled()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'status' => 'cancelled',
'status' => 'cancelled', ]);
];
});
} }
/** /**
@ -140,16 +130,12 @@ class Bill extends Factory
*/ */
public function recurring() public function recurring()
{ {
return $this->state(function (array $attributes) { return $this->state([
$frequencies = ['monthly', 'weekly']; 'recurring_frequency' => 'yes',
'recurring_interval' => '1',
return [ 'recurring_custom_frequency' => $this->faker->randomElement(['monthly', 'weekly']),
'recurring_frequency' => 'yes', 'recurring_count' => '1',
'recurring_interval' => '1', ]);
'recurring_custom_frequency' => $this->faker->randomElement($frequencies),
'recurring_count' => '1',
];
});
} }
/** /**

View File

@ -39,11 +39,9 @@ class Category extends Factory
*/ */
public function enabled() public function enabled()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'enabled' => 1,
'enabled' => 1, ]);
];
});
} }
/** /**
@ -53,11 +51,9 @@ class Category extends Factory
*/ */
public function disabled() public function disabled()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'enabled' => 0,
'enabled' => 0, ]);
];
});
} }
/** /**
@ -67,11 +63,9 @@ class Category extends Factory
*/ */
public function income() public function income()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'type' => 'income',
'type' => 'income', ]);
];
});
} }
/** /**
@ -81,11 +75,9 @@ class Category extends Factory
*/ */
public function expense() public function expense()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'type' => 'expense',
'type' => 'expense', ]);
];
});
} }
/** /**
@ -95,11 +87,9 @@ class Category extends Factory
*/ */
public function item() public function item()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'type' => 'item',
'type' => 'item', ]);
];
});
} }
/** /**
@ -109,10 +99,8 @@ class Category extends Factory
*/ */
public function other() public function other()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'type' => 'other',
'type' => 'other', ]);
];
});
} }
} }

View File

@ -49,11 +49,9 @@ class Contact extends Factory
*/ */
public function enabled() public function enabled()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'enabled' => 1,
'enabled' => 1, ]);
];
});
} }
/** /**
@ -63,11 +61,9 @@ class Contact extends Factory
*/ */
public function disabled() public function disabled()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'enabled' => 0,
'enabled' => 0, ]);
];
});
} }
/** /**
@ -77,11 +73,9 @@ class Contact extends Factory
*/ */
public function customer() public function customer()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'type' => 'customer',
'type' => 'customer', ]);
];
});
} }
/** /**
@ -91,10 +85,8 @@ class Contact extends Factory
*/ */
public function vendor() public function vendor()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'type' => 'vendor',
'type' => 'vendor', ]);
];
});
} }
} }

View File

@ -57,11 +57,9 @@ class Currency extends Factory
*/ */
public function enabled() public function enabled()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'enabled' => 1,
'enabled' => 1, ]);
];
});
} }
/** /**
@ -71,10 +69,8 @@ class Currency extends Factory
*/ */
public function disabled() public function disabled()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'enabled' => 0,
'enabled' => 0, ]);
];
});
} }
} }

View File

@ -35,11 +35,9 @@ class Dashboard extends Factory
*/ */
public function enabled() public function enabled()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'enabled' => 1,
'enabled' => 1, ]);
];
});
} }
/** /**
@ -49,11 +47,9 @@ class Dashboard extends Factory
*/ */
public function disabled() public function disabled()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'enabled' => 0,
'enabled' => 0, ]);
];
});
} }
/** /**
@ -63,11 +59,9 @@ class Dashboard extends Factory
*/ */
public function users() public function users()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'users' => $this->getCompanyUsers(),
'users' => $this->getCompanyUsers(), ]);
];
});
} }
/** /**

View File

@ -71,11 +71,9 @@ class Invoice extends Factory
*/ */
public function draft() public function draft()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'status' => 'draft',
'status' => 'draft', ]);
];
});
} }
/** /**
@ -85,11 +83,9 @@ class Invoice extends Factory
*/ */
public function sent() public function sent()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'status' => 'sent',
'status' => 'sent', ]);
];
});
} }
/** /**
@ -99,11 +95,9 @@ class Invoice extends Factory
*/ */
public function viewed() public function viewed()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'status' => 'viewed',
'status' => 'viewed', ]);
];
});
} }
/** /**
@ -113,11 +107,9 @@ class Invoice extends Factory
*/ */
public function partial() public function partial()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'status' => 'partial',
'status' => 'partial', ]);
];
});
} }
/** /**
@ -127,11 +119,9 @@ class Invoice extends Factory
*/ */
public function paid() public function paid()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'status' => 'paid',
'status' => 'paid', ]);
];
});
} }
/** /**
@ -141,11 +131,9 @@ class Invoice extends Factory
*/ */
public function cancelled() public function cancelled()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'status' => 'cancelled',
'status' => 'cancelled', ]);
];
});
} }
/** /**
@ -155,16 +143,12 @@ class Invoice extends Factory
*/ */
public function recurring() public function recurring()
{ {
return $this->state(function (array $attributes) { return $this->state([
$frequencies = ['monthly', 'weekly']; 'recurring_frequency' => 'yes',
'recurring_interval' => '1',
return [ 'recurring_custom_frequency' => $this->faker->randomElement(['monthly', 'weekly']),
'recurring_frequency' => 'yes', 'recurring_count' => '1',
'recurring_interval' => '1', ]);
'recurring_custom_frequency' => $this->faker->randomElement($frequencies),
'recurring_count' => '1',
];
});
} }
/** /**

View File

@ -40,11 +40,9 @@ class Item extends Factory
*/ */
public function enabled() public function enabled()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'enabled' => 1,
'enabled' => 1, ]);
];
});
} }
/** /**
@ -54,10 +52,8 @@ class Item extends Factory
*/ */
public function disabled() public function disabled()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'enabled' => 0,
'enabled' => 0, ]);
];
});
} }
} }

View File

@ -38,16 +38,9 @@ class Role extends Factory
*/ */
public function permissions() public function permissions()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'permissions' => $this->getPermissions(),
'permissions' => $this->getPermissions(), ]);
];
});
}
protected function getPermissions()
{
return Permission::take(50)->pluck('id')->toArray();
} }
/** /**
@ -61,4 +54,9 @@ class Role extends Factory
$role->permissions()->attach($this->getPermissions()); $role->permissions()->attach($this->getPermissions());
}); });
} }
protected function getPermissions()
{
return Permission::take(50)->pluck('id')->toArray();
}
} }

View File

@ -39,11 +39,9 @@ class Tax extends Factory
*/ */
public function enabled() public function enabled()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'enabled' => 1,
'enabled' => 1, ]);
];
});
} }
/** /**
@ -53,11 +51,9 @@ class Tax extends Factory
*/ */
public function disabled() public function disabled()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'enabled' => 0,
'enabled' => 0, ]);
];
});
} }
/** /**
@ -67,11 +63,9 @@ class Tax extends Factory
*/ */
public function normal() public function normal()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'type' => 'normal',
'type' => 'normal', ]);
];
});
} }
/** /**
@ -81,11 +75,9 @@ class Tax extends Factory
*/ */
public function inclusive() public function inclusive()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'type' => 'inclusive',
'type' => 'inclusive', ]);
];
});
} }
/** /**
@ -95,11 +87,9 @@ class Tax extends Factory
*/ */
public function compound() public function compound()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'type' => 'compound',
'type' => 'compound', ]);
];
});
} }
/** /**
@ -109,11 +99,9 @@ class Tax extends Factory
*/ */
public function fixed() public function fixed()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'type' => 'fixed',
'type' => 'fixed', ]);
];
});
} }
/** /**
@ -123,10 +111,8 @@ class Tax extends Factory
*/ */
public function withholding() public function withholding()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'type' => 'withholding',
'type' => 'withholding', ]);
];
});
} }
} }

View File

@ -49,12 +49,10 @@ class Transaction extends Factory
*/ */
public function income() public function income()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'type' => 'income',
'type' => 'income', 'category_id' => $this->company->categories()->income()->get()->random(1)->pluck('id')->first(),
'category_id' => $this->company->categories()->income()->get()->random(1)->pluck('id')->first(), ]);
];
});
} }
/** /**
@ -64,11 +62,9 @@ class Transaction extends Factory
*/ */
public function expense() public function expense()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'type' => 'expense',
'type' => 'expense', 'category_id' => $this->company->categories()->expense()->get()->random(1)->pluck('id')->first(),
'category_id' => $this->company->categories()->expense()->get()->random(1)->pluck('id')->first(), ]);
];
});
} }
} }

View File

@ -44,11 +44,9 @@ class User extends Factory
*/ */
public function enabled() public function enabled()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'enabled' => 1,
'enabled' => 1, ]);
];
});
} }
/** /**
@ -58,10 +56,8 @@ class User extends Factory
*/ */
public function disabled() public function disabled()
{ {
return $this->state(function (array $attributes) { return $this->state([
return [ 'enabled' => 0,
'enabled' => 0, ]);
];
});
} }
} }