auth(); $this->user = User::create([ "password" => app(User::class)->hashPassword("111111"), "email" => "liantiao@lientiao.com", "status" => User::STATUS_OK, "group_id" => 1, "phone" => 15012341234, "extra" => [ "permissions" => [1, 2], ], ]); User::create([ "password" => hashid_encode("111111"), "email" => "normal@lientiao.com", "status" => User::STATUS_OK, "group_id" => 2, "phone" => 13012341234, ]); $this->company(); Setting::create([ "type" => Setting::TYPE_BANNER, "key" => "banner1", "value" => ["is_use" => 1, "imageUrl" => "https://fendi-liaona.oss-cn-hangzhou.aliyuncs.com/yimei/logo/20230427/0db2bfbd1d3eccd33e03894128efdab1.png", "sort" => 9], ]); Setting::create([ "type" => Setting::TYPE_HOT_KEYWORD, "key" => "hot_keyword", "value" => ["热搜词1", "热搜词2"], ]); $this->goods(); } public function goods() { Spec::truncate(); SpecAttr::truncate(); Category::truncate(); Goods::truncate(); GoodsCategoryMap::truncate(); Spec::create(["name" => "颜色"]); Spec::create(["name" => "大小"]); SpecAttr::create(["spec_id" => 1, "name" => "红色"]); SpecAttr::create(["spec_id" => 1, "name" => "白色"]); SpecAttr::create(["spec_id" => 2, "name" => "大号"]); SpecAttr::create(["spec_id" => 2, "name" => "小号"]); Category::create(["name" => "一级分类", "thumb" => Image::imageUrl(300, 300), "level" => 1, "parent_id" => 0]); Category::create(["name" => "一级分类", "thumb" => Image::imageUrl(300, 300), "level" => 2, "parent_id" => 1]); Goods::create(["name" => "测试商品", "image_list" => [Image::imageUrl(), Image::imageUrl()], "spec" => [1, 2]]); GoodsCategoryMap::create(["goods_id" => 1, "category_id" => 2]); } public function company() { UserCompany::create(["name" => "测试企业", "tax_no" => "ooxx", "user_id" => $this->user->id]); } private function auth() { AdminGroup::truncate(); AdminPermission::truncate(); AdminGroup::create(["name" => "超级管理员"]); AdminGroup::create(["name" => "普通管理员"]); AdminGroup::create(["name" => "员工"]); AdminPermission::create(["name" => "权限1", "code" => "code1"]); AdminPermission::create(["name" => "权限2", "code" => "code2"]); } }