2020-01-30 20:01:45 +00:00
|
|
|
<?php
|
|
|
|
|
|
2021-10-04 08:30:32 +00:00
|
|
|
namespace Webkul\Checkout\Database\Factories;
|
2020-01-30 20:01:45 +00:00
|
|
|
|
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
use Webkul\Customer\Models\Customer;
|
|
|
|
|
use Webkul\Checkout\Models\Cart;
|
|
|
|
|
use Webkul\Checkout\Models\CartAddress;
|
2021-10-04 08:30:32 +00:00
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
|
|
|
|
|
|
class CartFactory extends Factory
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* The name of the factory's corresponding model.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
protected $model = Cart::class;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Define the model's default state.
|
|
|
|
|
*
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
public function definition(): array
|
|
|
|
|
{
|
|
|
|
|
$now = date("Y-m-d H:i:s");
|
|
|
|
|
|
|
|
|
|
$lastOrder = DB::table('orders')
|
|
|
|
|
->orderBy('id', 'desc')
|
|
|
|
|
->select('id')
|
|
|
|
|
->first();
|
|
|
|
|
|
2021-10-04 13:35:47 +00:00
|
|
|
$customer = Customer::factory()
|
|
|
|
|
->create();
|
2021-10-04 08:30:32 +00:00
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
'is_guest' => 0,
|
|
|
|
|
'is_active' => 1,
|
|
|
|
|
'customer_id' => $customer->id,
|
|
|
|
|
'customer_email' => $customer->email,
|
|
|
|
|
'customer_first_name' => $customer->first_name,
|
|
|
|
|
'customer_last_name' => $customer->last_name,
|
|
|
|
|
'is_gift' => 0,
|
|
|
|
|
'base_currency_code' => 'EUR',
|
|
|
|
|
'channel_currency_code' => 'EUR',
|
|
|
|
|
'grand_total' => 0.0000,
|
|
|
|
|
'base_grand_total' => 0.0000,
|
|
|
|
|
'sub_total' => 0.0000,
|
|
|
|
|
'base_sub_total' => 0.0000,
|
|
|
|
|
'channel_id' => 1,
|
|
|
|
|
'created_at' => $now,
|
|
|
|
|
'updated_at' => $now,
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-01-30 20:01:45 +00:00
|
|
|
|