购物车
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\CartModel;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* 购物车工厂(user_id / product_id 需调用方指定;无需 Faker)
|
||||
*
|
||||
* @extends Factory<CartModel>
|
||||
*/
|
||||
class CartModelFactory extends Factory
|
||||
{
|
||||
protected $model = CartModel::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'user_id' => 0,
|
||||
'product_id' => 0,
|
||||
'quantity' => number_format(random_int(100, 10000) / 100, 2, '.', ''),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user