gpt4 book ai didi

database - Laravel 4 db 种子特定的种子文件

转载 作者:太空狗 更新时间:2023-10-30 01:38:43 25 4
gpt4 key购买 nike

我有一个现有的用户表,其中包含通过 UserSeeder.php 中的 db:seed 播种的信息。现在,我正在添加新产品表并希望将信息播种到产品表中。我如何防止 Laravel 将 UserSeeder 播种到数据库中,但只播种新的 ProductSeeder?

谢谢。

最佳答案

您可以通过类名来调用各个种子类。来自docs .

By default, the db:seed command runs the DatabaseSeeder class, which may be used to call other seed classes. However, you may use the --class option to specify a specific seeder class to run individually:

php artisan db:seed --class=ProductTableSeeder

在上面的示例中,ProductTableSeeder 类应该存在于database/seeds 中。

关于database - Laravel 4 db 种子特定的种子文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20039684/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com