added fields to order related factories

This commit is contained in:
MonaHartdegen 2020-02-12 09:58:50 +01:00
parent 6243ad8c31
commit 2849ddd7db
3 changed files with 9 additions and 4 deletions

View File

@ -49,6 +49,8 @@ $factory->define(Order::class, function (Faker $faker) {
'channel_id' => 1,
'channel_type' => Channel::class,
'cart_id' => 0,
'shipping_method' => 'free_free',
'shipping_title' => 'Free Shipping',
];
});

View File

@ -31,6 +31,7 @@ $factory->define(OrderItem::class, function (Faker $faker) {
},
'created_at' => $now,
'updated_at' => $now,
'product_type' => Product::class,
];
});

View File

@ -6,12 +6,14 @@ use Faker\Generator as Faker;
use Illuminate\Support\Facades\DB;
use Webkul\Sales\Models\OrderPayment;
$factory->define(OrderPayment::class, function (Faker $faker) {
$now = date("Y-m-d H:i:s");
$factory->define(OrderPayment::class, function (Faker $faker, array $attributes) {
if (!array_key_exists('order_id', $attributes)) {
throw new InvalidArgumentException('order_id must be provided.');
}
return [
'created_at' => $now,
'updated_at' => $now,
'method' => 'cashondelivery',
];
});