prepaeres to some code for the tests
This commit is contained in:
28
database/factories/ItemFacorty.php
Normal file
28
database/factories/ItemFacorty.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Faker\Generator;
|
||||
use App\Models\Auth\User;
|
||||
use App\Models\Common\Item;
|
||||
use App\Models\Common\Company;
|
||||
use Illuminate\Database\Eloquent\Factory;
|
||||
|
||||
/** @var Factory $factory */
|
||||
$factory->define(Item::class, function (Generator $faker) {
|
||||
/** @var User $user */
|
||||
$user = User::first();
|
||||
/** @var Company $company */
|
||||
$company = $user->companies()->first();
|
||||
|
||||
return [
|
||||
'name' => $faker->title,
|
||||
'sku' => $faker->languageCode,
|
||||
'company_id' => $company->id,
|
||||
'description' => $faker->text(100),
|
||||
'purchase_price' => $faker->randomFloat(2,10,20),
|
||||
'sale_price' => $faker->randomFloat(2,10,20),
|
||||
'quantity' => $faker->randomNumber(2),
|
||||
'category_id' => $company->categories()->first()->id,
|
||||
'tax_id' => $company->taxes()->first()->id,
|
||||
'enabled' => $this->faker->boolean ? 1 : 0
|
||||
];
|
||||
});
|
@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
$factory->define(App\User::class, function (Faker\Generator $faker) {
|
||||
$factory->define(\App\Models\Auth\User::class, function (Faker\Generator $faker) {
|
||||
static $password;
|
||||
|
||||
return [
|
||||
|
Reference in New Issue
Block a user