feat: 系统语言seeder
This commit is contained in:
30
database/seeds/SysLanguageInit.php
Normal file
30
database/seeds/SysLanguageInit.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use think\migration\Seeder;
|
||||||
|
|
||||||
|
class SysLanguageInit 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, "country_id" => 1, "name" => "中文简体", "en_name" => "Simplified Chinese", "code" => "zh-cn", "icon" => "/static/common/images/langs/CN.png", "url" => "//dev.ow.f2b211.com", "status" => 1, "is_default" => 0, "sort" => 0, "created_at" => "2025-01-04 14:06:01", "updated_at" => "2025-05-24 14:18:16"],
|
||||||
|
["id" => 2, "country_id" => 2, "name" => "英语", "en_name" => "English", "code" => "en-us", "icon" => "/static/common/images/langs/US.png", "url" => "//dev.ow.us.f2b211.com", "status" => 1, "is_default" => 0, "sort" => 0, "created_at" => "2025-03-25 13:48:57", "updated_at" => "2025-05-24 14:18:16"]
|
||||||
|
];
|
||||||
|
|
||||||
|
$table = $this->table('sys_language');
|
||||||
|
|
||||||
|
// empty the table
|
||||||
|
$table->truncate();
|
||||||
|
|
||||||
|
// insert data
|
||||||
|
$table->insert($data)->saveData();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user