当前位置:网站首页>Laravel8 uses faker to call factory to fill data
Laravel8 uses faker to call factory to fill data
2022-06-24 14:27:00 【s_ Canned ice】
1. Install the population file through the command .
php artisan make:seeder UserSeeder2. stay database Find our fill file

3. Write the function method in our fill file
// Write seed file ( Use Chinese package )
$faker = Factory::create('zh_CN');
// How much test data to fill according to our needs ( I am here 20 So it's filling 20 Data )
for ($i = 0; $i <= 20; $i++) {
// Call the model to fill in the data
UddModel::create([
'username' => $faker->name,
'password' => bcrypt('123456'),]);
// notes : Add the creation time field in the process of filling data (updated_at) And modify the time field (updated_at) Prevent filling errors
}4. Execute our fill file to generate fill data
php artisan db:seed --class=UserSeeder边栏推荐
- postgresql 之 ilist
- [deep learning] storage form of nchw, nhwc and chwn format data
- [pytoch] quantification
- Keras deep learning practice (11) -- visual neural network middle layer output
- The function and principle of key in V-for
- 测试 H5 和小程序的区别,你真的知道吗?
- Overview of SAP marketing cloud functions (III)
- 二造考生必看|巩固优选题库助力考生最后冲刺
- API data interface for announcement of Hong Kong listed companies
- 15 differences between MES in process and discrete manufacturing enterprises (Part 2)
猜你喜欢

GO语言并发模型-MPG模型

Data sharing between laravel lower views

Py之toad:toad的简介、安装、使用方法之详细攻略

测试 H5 和小程序的区别,你真的知道吗?

Common singleton mode & simple factory

卷积核、特征图可视化

如何避免下重复订单

postgresql之List
![Generate binary tree according to preorder & inorder traversal [partition / generation / splicing of left subtree | root | right subtree]](/img/f7/8d026c0e4435fc8fd7a63616b4554d.png)
Generate binary tree according to preorder & inorder traversal [partition / generation / splicing of left subtree | root | right subtree]
![Maximum path sum in binary tree [handle any subtree, then handle the whole tree]](/img/d0/91ab1cc1851d7137a1cab3cf458302.png)
Maximum path sum in binary tree [handle any subtree, then handle the whole tree]
随机推荐
Research on MySQL composite index
Win10 system problems
P2pdb white paper
conda和pip命令
How to avoid placing duplicate orders
Digital business cloud: strengthen supplier management and promote efficient collaboration between air transport enterprises and suppliers
[untitled]
10_那些格调很高的个性签名
15 differences between MES in process and discrete manufacturing enterprises (Part 2)
In the eyes of the universe, how to correctly care about counting East and West?
How to solve the problem that iterative semi supervised training is difficult to implement in ASR training? RTC dev Meetup
Jupyter notebook操作
GO语言-init()函数-包初始化
Qunhui synchronizes with alicloud OSS
Method of establishing unity thermodynamic diagram
R语言实战应用精讲50篇(二十三)-贝叶斯理论重要概念: 可信度Credibility, 模型Models, 和参数Parameters
常见的单例模式&简单工厂
GO语言-goroutine协程的使用
Database considerations
postgresql之List