/** * Run the database seeds. * * @return void */ public function run() { Eloquent::unguard(); DB::table('companies')->delete(); DB::table('items')->delete(); DB::table('categories')->delete(); $territory = Territory::where('name', 'Stockholms län')->where('county', '01')->first(); $company1 = Company::create(array('id' => 1, 'name' => '北欧工作室', 'description' => 'chenyipingsheng: 如何设计api,应该先按模块拆分原则进行初步划分。(4) api返回数据文章中所说的对null的看法... app后端设计(10)--数据增量更新 chenyipingsheng: 文章中update_time的时间粒度选择的是分钟,如果某个时间段内新增的条数/分钟,超过了单页si...', 'territory_id' => $territory->id, 'url' => 'http://www.google.com', 'address' => '啊发扩大浪费大斗进发觉啦地方', 'established_year' => '2011')); $company2 = Company::create(array('id' => 2, 'name' => '阿呆姆斯工作室', 'description' => 'chenyipingsheng: 如何设计api,应该先按模块拆分原则进行初步划分。(4) api返回数据文章中所说的对null的看法... app后端设计(10)--数据增量更新 chenyipingsheng: 文章中update_time的时间粒度选择的是分钟,如果某个时间段内新增的条数/分钟,超过了单页si...', 'territory_id' => $territory->id, 'url' => 'http://www.google.com', 'address' => '饿我热哦我iooewpp', 'established_year' => '2013')); $item1 = Item::create(array('id' => 1, 'company_id' => 1, 'name' => 'Kayala投资项目', 'description' => '做了3年app相关的系统架构,api设计,先后在3个创业公司中工作,经历过手机网页端,android客户端,iphone客户端,现就职于app云后端平台bmob(想了解bmob点击这里)。其中的乐与苦,得与失,仰首问天有谁知?我觉得是时候来个总结,把相关的技术和心得记录下来。', 'territory_id' => $territory->id, 'url' => 'http://www.google.com', 'min_investment' => 20000000)); $item2 = Item::create(array('id' => 2, 'company_id' => 1, 'name' => '棕熊城堡出售', 'description' => '做了3年app相关的系统架构,api设计,先后在3个创业公司中工作,经历过手机网页端,android客户端,iphone客户端,现就职于app云后端平台bmob(想了解bmob点击这里)。其中的乐与苦,得与失,仰首问天有谁知?我觉得是时候来个总结,把相关的技术和心得记录下来。', 'territory_id' => $territory->id, 'url' => 'http://www.google.com', 'min_investment' => 30000000, 'max_investment' => 30000000)); $item3 = Item::create(array('id' => 3, 'company_id' => 2, 'name' => '布鲁艾尔空气净化器', 'description' => '做了3年app相关的系统架构,api设计,先后在3个创业公司中工作,经历过手机网页端,android客户端,iphone客户端,现就职于app云后端平台bmob(想了解bmob点击这里)。其中的乐与苦,得与失,仰首问天有谁知?我觉得是时候来个总结,把相关的技术和心得记录下来。', 'territory_id' => $territory->id, 'url' => 'http://www.google.com', 'min_investment' => 10000000, 'max_investment' => 10000000)); $item4 = Item::create(array('id' => 4, 'company_id' => 2, 'name' => 'volvo公司转让', 'description' => '做了3年app相关的系统架构,api设计,先后在3个创业公司中工作,经历过手机网页端,android客户端,iphone客户端,现就职于app云后端平台bmob(想了解bmob点击这里)。其中的乐与苦,得与失,仰首问天有谁知?我觉得是时候来个总结,把相关的技术和心得记录下来。', 'territory_id' => $territory->id, 'url' => 'http://www.google.com', 'min_investment' => 250000000, 'max_investment' => 250000000)); Category::create(array('id' => 1, 'name' => '融资项目')); Category::create(array('id' => 2, 'name' => '房产出售')); Category::create(array('id' => 3, 'name' => '产品推广')); Category::create(array('id' => 4, 'name' => '公司转让')); Category::create(array('id' => 5, 'name' => '技术出售')); Category::create(array('id' => 6, 'name' => '文化, 媒体, 旅游')); CompanyCategory::create(array('id' => 1, 'company_id' => 1, 'category_id' => 6)); CompanyCategory::create(array('id' => 2, 'company_id' => 2, 'category_id' => 6)); ItemCategory::create(array('id' => 1, 'item_id' => 1, 'category_id' => 1)); ItemCategory::create(array('id' => 2, 'item_id' => 1, 'category_id' => 2)); ItemCategory::create(array('id' => 3, 'item_id' => 2, 'category_id' => 2)); ItemCategory::create(array('id' => 4, 'item_id' => 3, 'category_id' => 4)); ItemCategory::create(array('id' => 5, 'item_id' => 3, 'category_id' => 5)); ItemCategory::create(array('id' => 6, 'item_id' => 3, 'category_id' => 6)); ItemCategory::create(array('id' => 7, 'item_id' => 4, 'category_id' => 3)); ItemCategory::create(array('id' => 8, 'item_id' => 4, 'category_id' => 5)); Tag::create(array('id' => 1, 'name' => '回报率高')); Tag::create(array('id' => 2, 'name' => '绿色环保')); Tag::create(array('id' => 3, 'name' => '市场巨大')); Tag::create(array('id' => 4, 'name' => '用途广')); Tag::create(array('id' => 5, 'name' => '历史悠久')); Tag::create(array('id' => 6, 'name' => '可自雇')); Tag::create(array('id' => 7, 'name' => 'PM2.5')); ItemTag::create(array('id' => 1, 'tag_id' => 1, 'item_id' => 1)); ItemTag::create(array('id' => 2, 'tag_id' => 2, 'item_id' => 1)); ItemTag::create(array('id' => 3, 'tag_id' => 3, 'item_id' => 1)); ItemTag::create(array('id' => 4, 'tag_id' => 2, 'item_id' => 2)); ItemTag::create(array('id' => 5, 'tag_id' => 3, 'item_id' => 2)); ItemTag::create(array('id' => 6, 'tag_id' => 4, 'item_id' => 2)); ItemTag::create(array('id' => 7, 'tag_id' => 5, 'item_id' => 3)); ItemTag::create(array('id' => 8, 'tag_id' => 6, 'item_id' => 3)); ItemTag::create(array('id' => 9, 'tag_id' => 7, 'item_id' => 3)); ItemTag::create(array('id' => 10, 'tag_id' => 3, 'item_id' => 4)); ItemTag::create(array('id' => 11, 'tag_id' => 6, 'item_id' => 4)); }
} switch ($action) { case 'list': break; case 'new': // Check permission: $current_User->check_perm('options', 'edit', true); $edited_ItemTag = new ItemTag(); break; case 'edit': // Check permission: $current_User->check_perm('options', 'edit', true); break; case 'create': // Create new tag... $edited_ItemTag = new ItemTag(); // Check that this action request is not a CSRF hacked request: $Session->assert_received_crumb('tag'); // Check that current user has permission to create tags: $current_User->check_perm('options', 'edit', true); // load data from request if ($edited_ItemTag->load_from_Request()) { // We could load data from form without errors: // Insert in DB: $edited_ItemTag->dbinsert(); $Messages->add(T_('New tag has been created.'), 'success'); // Redirect so that a reload doesn't write to the DB twice: header_redirect($admin_url . '?ctrl=itemtags', 303); // Will EXIT // We have EXITed already at this point!! }