45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Warehouse>
|
|
*/
|
|
class WarehouseFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'name' => $this->faker->company . '仓库',
|
|
'type' => 'erp',
|
|
'cloud_system' => null,
|
|
'owner_code' => null,
|
|
'cloud_code' => null,
|
|
'app_key' => null,
|
|
'app_secret' => null,
|
|
'remark' => $this->faker->sentence(),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* 云仓类型
|
|
*/
|
|
public function cloud(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'type' => 'cloud',
|
|
'cloud_system' => $this->faker->randomElement(['jst', 'wdt', 'qimen']),
|
|
'owner_code' => 'OWNER' . $this->faker->randomNumber(6),
|
|
'cloud_code' => 'CLOUD' . $this->faker->randomNumber(6),
|
|
'app_key' => $this->faker->md5(),
|
|
'app_secret' => $this->faker->sha256(),
|
|
]);
|
|
}
|
|
} |