quickclack / database-filler
此包用于在 Laravel 项目中创建和运行填充器
1.0.0
2023-06-03 11:07 UTC
Requires
- php: ^8.0.2|^8.1
This package is auto-updated.
Last update: 2024-10-03 14:16:04 UTC
README
此包将帮助您使用 PHP 类更新数据库数据
安装
composer require quickclack/database-filler:dev-master
用法
- php artisan migrate
- 在 ./database 中创建 fillers 目录
- php artisan make:filler UpdateProductPriceFiller
<?php
declare(strict_types = 1);
use Illuminate\Support\Facades\DB;
return new class
{
public function run(): void
{
DB::table('prices')
->where('product_id', '=', 1)
->update([
'price' => 18.99
]);
}
};
- php artisan db:fill
许可证
MIT 许可证 (MIT)。请参阅 许可证文件 获取更多信息。