feat: 产品购买平台seeder
This commit is contained in:
32
database/seeds/ProductPurchasePlatformInit.php
Normal file
32
database/seeds/ProductPurchasePlatformInit.php
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use think\migration\Seeder;
|
||||||
|
|
||||||
|
class ProductPurchasePlatformInit extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run Method.
|
||||||
|
*
|
||||||
|
* Write your database seeder using this method.
|
||||||
|
*
|
||||||
|
* More information on writing seeders is available here:
|
||||||
|
* http://docs.phinx.org/en/latest/seeding.html
|
||||||
|
*/
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
["id" => 1, "language_id" => 1, "platform" => "京东购买", "desc" => null, "sort" => 0, "created_at" => "2025-02-18 14:55:11"],
|
||||||
|
["id" => 2, "language_id" => 1, "platform" => "天猫购买", "desc" => null, "sort" => 0, "created_at" => "2025-02-18 14:55:31"],
|
||||||
|
["id" => 3, "language_id" => 2, "platform" => "Shop on ORlCO Store", "desc" => null, "sort" => 0, "created_at" => "2025-04-25 16:37:39"],
|
||||||
|
["id" => 4, "language_id" => 2, "platform" => "Shop on Amazon", "desc" => null, "sort" => 0, "created_at" => "2025-04-25 16:37:47"],
|
||||||
|
];
|
||||||
|
|
||||||
|
$table = $this->table('product_purchase_platform');
|
||||||
|
|
||||||
|
// empty the table
|
||||||
|
$table->truncate();
|
||||||
|
|
||||||
|
// insert data
|
||||||
|
$table->insert($data)->saveData();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user