meops/laravel-populate
最新稳定版本:1.0.4
Composer 安装命令:
composer require meops/laravel-populate
包简介
Populate the DB in your Laravel application
README 文档
README
An Artisan command for populating your database. It allows you to quickly create records in your database using the model factories you have already defined in your Laravel application without writing seeders.
Installation
Install the package as a development dependency:
composer require --dev meops/laravel-populate
Usage
Records are created by specifying the model whose factory definition should be used to generate field values.
Create a single record
The first argument specifies the model to create. The package will look for a matching model name in the App/Models directory by default:
php artisan db:populate User
Use double backslashes to escape slashes in a fully qualified class name:
php artisan db:populate MyNamespace\\User
Create multiple records
The second argument is optional and specifies the number of records to create:
php artisan db:populate User 10
Create multiple records with custom data
Specify any fields whose values should be overriden using the -o option with the format field=value. Multiple fields can be overriden by providing multiple -o options.
php artisan db:populate User -o email=me@example.com -o password=secret
Prerequisites
Any model you wish to populate must have a factory defined.
统计信息
- 总下载量: 22
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-11-05