Commit fcc79c6c by 杨树贤

订单数据seeder

parent 711f256d
......@@ -60,7 +60,8 @@ class HandleInquiry extends Form implements LazyRenderable
public function default()
{
return [
'status' => 1,
'handle_result' => 'test'
];
}
}
<?php
/** @var \Illuminate\Database\Eloquent\Factory $factory */
use Faker\Generator as Faker;
$factory->define(\App\Models\OrderAddress::class, function (Faker $faker) {
$order = \App\Models\Order::inRandomOrder()->first();
return [
'user_id' => $order->user_id,
'order_id' => $order->order_id,
'address_type' => $faker->numberBetween(1, 2),
'consignee' => $faker->company(),
'email' => $faker->email(),
'phone' => $faker->phoneNumber(),
'country' => $faker->numberBetween(1,240),
'province' => $faker->country(),
'city' => $faker->city(),
'detail_address' => $faker->address(),
'create_time' => time() + rand(1, 2000),
];
});
<?php
/** @var \Illuminate\Database\Eloquent\Factory $factory */
use Faker\Generator as Faker;
$factory->define(\App\Models\Order::class, function (Faker $faker) {
return [
'order_sn' => \Illuminate\Support\Str::random(10),
'erp_order_id' => $faker->numberBetween(1000000, 1000100),
'order_type' => 1,
'order_source' => 1,
'order_pay_type' => $faker->numberBetween(1, 3),
'order_user_pay_type' => $faker->numberBetween(1, 2),
'user_id' => \App\Models\User::inRandomOrder()->first()->id,
'company_name' => $faker->company(),
'order_amount' => $faker->numberBetween(10, 1000),
'advance_amount' => $faker->randomDigit(),
'exchange_rate' => 7.2,
'currency' => 2,
'order_remark' => $faker->text(),
'status' => $faker->numberBetween(-1, 3),
'create_time' => time() - random_int(1000, 20000),
'confirm_time' => time() - random_int(1000, 20000),
'advance_pay_time' => time() - random_int(1000, 20000),
'pay_time' => time() - random_int(1000, 20000),
'shipping_time' => time() - random_int(1000, 20000),
'cancel_time' => time() - random_int(1000, 20000),
'sale_id' => $faker->numberBetween(1000, 1200),
'sale_name' => $faker->name,
'creator_uid' => $faker->numberBetween(1000, 1200),
'updator_uid' => $faker->numberBetween(1000, 1200),
'update_time' => time() - random_int(100, 2000),
];
});
<?php
/** @var \Illuminate\Database\Eloquent\Factory $factory */
use Faker\Generator as Faker;
$factory->define(\App\Models\OrderItem::class, function (Faker $faker) {
$order = \App\Models\Order::inRandomOrder()->first();
return [
'order_id' => $order->order_id,
'user_id' => $order->user_id,
'goods_id' => $faker->numberBetween(1164552298063444632,1164552298063464632),
'supplier_id' => $faker->numberBetween(1, 17),
'brand_id' => $faker->numberBetween(1, 1000),
'standard_brand_id' => $faker->numberBetween(1, 300),
'goods_name' => \Illuminate\Support\Str::random(10),
'class_id2' => $faker->numberBetween(1, 300),
'batch' => \Illuminate\Support\Str::random(10),
'class_id2_name' => \Illuminate\Support\Str::random(10),
'supplier_name' => \Illuminate\Support\Str::random(10),
'brand_name' => \Illuminate\Support\Str::random(10),
'standard_brand_name' => \Illuminate\Support\Str::random(10),
'goods_type' => $faker->numberBetween(1, 2),
'goods_number' =>$faker->numberBetween(10, 200),
'goods_price' => $faker->randomDigit(),
'goods_unit' => \Illuminate\Support\Str::random(2),
'delivery_time' =>time() - random_int(1000, 20000),
'canal' => \Illuminate\Support\Str::random(5),
'status' => 1,
'initial_price' => $faker->randomDigit(),
'purchase_uid' => $faker->numberBetween(1000, 1200),
'purchase_name' => \Illuminate\Support\Str::random(10),
'contract_remark' => \Illuminate\Support\Str::random(10),
'discount_amount' => $faker->randomDigit(),
'other_amount' => $faker->randomDigit(),
'remarks' => $faker->text,
];
});
......@@ -11,9 +11,11 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
$this->call(UserAddressSeeder::class);
// $this->call(UserAddressSeeder::class);
// $this->call(UserSeeder::class);
// $this->call(InquirySeeder::class);
// $this->call(InquiryItemsSeeder::class);
// $this->call(OrderSeeder::class);
$this->call(OrderAddressSeeder::class);
}
}
<?php
use Illuminate\Database\Seeder;
class OrderAddressSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
factory(App\Models\OrderAddress::class, 50)->create()->each(function ($user) {
$user->insert(factory(\App\Models\OrderAddress::class)->make());
});
}
}
<?php
use Illuminate\Database\Seeder;
class OrderItemsSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
factory(App\Models\OrderItem::class, 200)->create()->each(function ($user) {
$user->insert(factory(\App\Models\OrderItem::class)->make());
});
}
}
<?php
use Illuminate\Database\Seeder;
class OrderSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
factory(App\Models\Order::class, 50)->create()->each(function ($user) {
$user->insert(factory(\App\Models\Order::class)->make());
});
}
}
......@@ -29,7 +29,8 @@ return [
],
'sales_user' => [
'name' => '业务员',
]
],
'source' => '来源'
],
'options' => [
'status' => [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment