feat: 代理商业务类型seeder
This commit is contained in:
34
database/seeds/AgentBusinessTypeInit.php
Normal file
34
database/seeds/AgentBusinessTypeInit.php
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use think\migration\Seeder;
|
||||||
|
|
||||||
|
class AgentBusinessTypeInit 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, "name" => "在线商店", "value" => "Online Store", "desc" => null, "sort" => 0, "created_at" => "2025-03-13 17:50:36"],
|
||||||
|
["id" => 2, "language_id" => 1, "name" => "本地商店", "value" => "Local store", "desc" => null, "sort" => 2, "created_at" => "2025-03-13 17:50:57"],
|
||||||
|
["id" => 3, "language_id" => 1, "name" => "两者都有", "value" => "Both", "desc" => null, "sort" => 0, "created_at" => "2025-03-13 17:51:14"],
|
||||||
|
["id" => 4, "language_id" => 2, "name" => "Online Store", "value" => "Online Store", "desc" => null, "sort" => 0, "created_at" => "2025-03-13 17:50:36"],
|
||||||
|
["id" => 5, "language_id" => 2, "name" => "Local store", "value" => "Local store", "desc" => null, "sort" => 2, "created_at" => "2025-03-13 17:50:57"],
|
||||||
|
["id" => 6, "language_id" => 2, "name" => "Both", "value" => "Both", "desc" => null, "sort" => 0, "created_at" => "2025-03-13 17:51:14"]
|
||||||
|
];
|
||||||
|
|
||||||
|
$table = $this->table('agent_business_type');
|
||||||
|
|
||||||
|
// empty the table
|
||||||
|
$table->truncate();
|
||||||
|
|
||||||
|
// insert data
|
||||||
|
$table->insert($data)->saveData();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user