购物车
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\ProductPriceModel;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* 商品等级价格工厂(product_id / level_id 需调用方指定;无需 Faker)
|
||||
*
|
||||
* @extends Factory<ProductPriceModel>
|
||||
*/
|
||||
class ProductPriceModelFactory extends Factory
|
||||
{
|
||||
protected $model = ProductPriceModel::class;
|
||||
|
||||
private static int $sequence = 0;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
$seq = ++self::$sequence;
|
||||
|
||||
return [
|
||||
'product_id' => 0,
|
||||
'level_id' => 0,
|
||||
'price' => number_format(random_int(100, 10000) / 100 + $seq * 0.01, 2, '.', ''),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user