当前位置: 首页>>代码示例>>PHP>>正文


PHP Item::create方法代码示例

本文整理汇总了PHP中Item::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Item::create方法的具体用法?PHP Item::create怎么用?PHP Item::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Item的用法示例。


在下文中一共展示了Item::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 /**
  * @see EquipmentInterface::create()
  * @param integer $type_id
  * @param integer $owner_id
  * @return integer
  * @throws EquipmentCreateFailedException
  * @throws EquipmentCreateAsItemException
  * @throws EquipmentCreateIDMissingException
  */
 public function create($type_id, $owner_id)
 {
     global $transaction;
     if (is_numeric($type_id) and is_numeric($owner_id)) {
         $transaction_id = $transaction->begin();
         try {
             if (($equipment_id = $this->equipment->create($type_id, $owner_id)) == null) {
                 throw new EquipmentCreateFailedException();
             }
             $this->item_id = parent::create();
             $equipment_is_item = new EquipmentIsItem_Access(null);
             if ($equipment_is_item->create($equipment_id, $this->item_id) == false) {
                 throw new EquipmentCreateAsItemException();
             }
         } catch (BaseException $e) {
             if ($transaction_id != null) {
                 $transaction->rollback($transaction_id);
             }
             throw $e;
         }
         if ($transaction_id != null) {
             $transaction->commit($transaction_id);
         }
         self::__construct($equipment_id);
         return $equipment_id;
     } else {
         throw new EquipmentCreateIDMissingException();
     }
 }
开发者ID:suxinde2009,项目名称:www,代码行数:38,代码来源:equipment.class.php

示例2: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 50) as $index) {
         Item::create(['name' => $faker->text(10), 'description' => $faker->text(200), 'price' => $faker->randomFloat(2, 0, 100), 'item_category_id' => $faker->randomElement([1, 2, 3, 4, 5])]);
     }
 }
开发者ID:udayrockstar,项目名称:RestaurantManager,代码行数:7,代码来源:ItemsTableSeeder.php

示例3: run

 public function run()
 {
     // Barracks Items
     $barracks = Map::where('location_name', 'barracks')->firstOrFail();
     Item::create(['name' => 'sword', 'map_id' => $barracks->id]);
     Item::create(['name' => 'armor', 'map_id' => $barracks->id]);
     Item::create(['name' => 'key', 'map_id' => $barracks->id]);
     // Southwest Tower Item
     $southWestTower = Map::where('location_name', 'southwest_tower_outer')->firstOrFail();
     Item::create(['name' => 'lantern', 'map_id' => $southWestTower->id]);
     // Kitchen Items
     $kitchen = Map::where('location_name', 'kitchen')->firstOrFail();
     Item::create(['name' => 'apple', 'map_id' => $kitchen->id]);
     Item::create(['name' => 'bread', 'map_id' => $kitchen->id]);
     // Reception Room Item
     $receptionRoom = Map::where('location_name', 'reception_room')->firstOrFail();
     Item::create(['name' => 'wine', 'map_id' => $receptionRoom->id]);
     // Wizard Tower Items
     $wizardTower = Map::where('location_name', 'wizard_tower')->firstOrFail();
     Item::create(['name' => 'potion_invisibility', 'map_id' => $wizardTower->id]);
     Item::create(['name' => 'potion_strength', 'map_id' => $wizardTower->id]);
     Item::create(['name' => 'potion_regeneration', 'map_id' => $wizardTower->id]);
     // Dressing Room Item
     $dressingRoom = Map::where('location_name', 'dressing_room')->firstOrFail();
     Item::create(['name' => 'gown', 'map_id' => $dressingRoom->id]);
     // Study Item
     $study = Map::where('location_name', 'study')->firstOrFail();
     Item::create(['name' => 'note', 'map_id' => $study->id]);
     // King Chamber Item
     $kingChamber = Map::where('location_name', 'king_chamber')->firstOrFail();
     Item::create(['name' => 'crown', 'map_id' => $kingChamber->id]);
 }
开发者ID:Borq-Gaming,项目名称:borq.dev,代码行数:32,代码来源:ItemsTableSeeder.php

示例4: run

 public function run()
 {
     DB::table('items')->delete();
     for ($i = 1; $i <= 100; $i++) {
         Item::create(array('title' => 'item test ' . $i));
     }
 }
开发者ID:Chanpa-Majumder,项目名称:Ticket-Create-System,代码行数:7,代码来源:DatabaseSeeder.php

示例5: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Item::create([]);
     }
 }
开发者ID:kenkode,项目名称:xaraerp,代码行数:7,代码来源:ItemsTableSeeder.php

示例6: run

 public function run()
 {
     $title = array('ピカチュウ', 'カイリュウ', 'ヤドラン', 'ピジョン', 'コダック', 'コラッタ', 'ズバット', 'ギャロップ');
     $now = date('Y-m-d H:i:s');
     $type = 'video';
     foreach ($title as $t) {
         Item::create(array('category_id' => mt_rand(1, 29), 'user_id' => mt_rand(1, 4), 'title' => $t, 'content' => "{$t} の content やで", 'type' => $type, 'created_at' => $now, 'updated_at' => $now));
     }
 }
开发者ID:return-zero,项目名称:ma9,代码行数:9,代码来源:ItemSeeder.php

示例7: store

 /**
  * Store a newly created item in storage.
  *
  * @return Response
  */
 public function store()
 {
     if (Input::has('clearForm')) {
         return Redirect::route('items.index');
     }
     if (Input::get('selectedItem')) {
         $targetID = Input::get('selectedItem');
         $item = Item::find($targetID);
         $shops = Shop::all();
         $categories = Category::all();
         return View::make('items.index', compact('item', 'categories', 'shops'));
     }
     $validator = Validator::make($data = Input::all(), Item::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     /* Item */
     if (Input::has('createItem')) {
         $id = DB::table('BTSMAS')->count();
         $id++;
         $file = $id . '.png';
         if (move_uploaded_file($_FILES['upload']['tmp_name'], $file)) {
             echo $file;
         } else {
             echo "error";
         }
         $data['contents'] = file_get_contents($file);
         unlink($file);
         Item::create($data);
         $message = "登録しました。";
     }
     if (Input::has('deleteItem')) {
         $id = Input::get('idItem');
         Item::destroy($id);
         $message = "削除しました。";
     }
     if (Input::has('updateItem')) {
         $id = Input::get('idItem');
         $item = Item::find($id);
         $item->title = Input::get('title');
         $item->price = Input::get('price');
         $item->genka = Input::get('genka');
         $item->Bumon = Input::get('Bumon');
         $item->Kosu = Input::get('Kosu');
         if (file_exists($_FILES['upload']['tmp_name'])) {
             $file = $id . '.png';
             move_uploaded_file($_FILES['upload']['tmp_name'], $file);
             $item->contents = file_get_contents($file);
             unlink($file);
         }
         $item->save();
         $message = "更新しました。";
     }
     return Redirect::route('items.index')->with('message', $message);
 }
开发者ID:noikiy,项目名称:posco-laravel-server,代码行数:60,代码来源:ItemsController.php

示例8: sync

 public static function sync($params)
 {
     $item = Item::find_by_subject($params["type"], $params["id"]);
     if (empty($item)) {
         // create
         Item::create($params);
     } else {
         // sync
         $item->update($params);
     }
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:11,代码来源:Item.php

示例9: run

    /**
     * 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));
    }
开发者ID:rhalff,项目名称:vdragon-api,代码行数:57,代码来源:TestDataSeeder.php

示例10: run

 public function run()
 {
     DB::table('items')->delete();
     $set = Set::find(1);
     $item1 = Item::create(array('item_id' => 1, 'name' => 'ATH-M50x Professional Monitor Headphones', 'creator' => 1, 'image_url' => 'https://d2qmzng4l690lq.cloudfront.net/resizer/450x450/v/VDWZ23_20140202_100823_2E9CC3160EB4DE7586.png'));
     $item1->sets()->attach(1);
     sleep(1);
     $item2 = Item::create(array('item_id' => 2, 'name' => 'FiiO E17 USB DAC Headphone Amplifier', 'creator' => 1, 'image_url' => 'https://d2qmzng4l690lq.cloudfront.net/resizer/450x450/v/2FNXFT_20130816_132147_OPWOOEWLU125PK8HXM.png'));
     $item2->sets()->attach(1);
     sleep(1);
     $item3 = Item::create(array('item_id' => 3, 'name' => 'iBasso DX50 Digital Audio Player', 'creator' => 1, 'image_url' => 'https://d2qmzng4l690lq.cloudfront.net/resizer/450x450/v/EJ6QKT_20140530_194403_0F8FDF5FA221AAC02E.png'));
     $item3->sets()->attach(1);
 }
开发者ID:heekah7,项目名称:massdrop,代码行数:13,代码来源:ItemTableSeeder.php

示例11: add

 public static function add(GatheringDataSourceConfiguration $configuration, $post)
 {
     $gathering = $configuration->getGatheringObject();
     try {
         // we wrap this in a try because it MIGHT fail if it's a duplicate
         $item = parent::create($gathering, $configuration->getGatheringDataSourceObject(), $post->get_date('Y-m-d H:i:s'), $post->get_title(), $post->get_link());
     } catch (Exception $e) {
     }
     if (is_object($item)) {
         $item->assignFeatureAssignments($post);
         $item->setAutomaticGatheringItemTemplate();
         return $item;
     }
 }
开发者ID:digideskio,项目名称:concrete5,代码行数:14,代码来源:FlickrFeed.php

示例12: postAdd

 public function postAdd()
 {
     $params = Input::all();
     $item = Item::create(array('name' => $params['title'], 'item_code' => '', 'updated' => time(), 'created' => time()));
     foreach ($params['items'] as $param) {
         // レビューの抽出
         if ($param['itemFrom'] == 'rakuten') {
             Review::getReviews($param['itemCode'], $item->id);
         } else {
             Review::getAmazonReview($param['itemCode'], $item->id);
         }
     }
     $response = array('status' => 'ok', 'id' => $item->id);
     return json_encode($response);
 }
开发者ID:RyoBamboo,项目名称:RoughSetSystem,代码行数:15,代码来源:ReviewController.php

示例13: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     for ($i = 0; $i < 100; $i++) {
         $type = $faker->numberBetween(1, 3);
         switch ($type) {
             case 1:
                 $name = ucfirst($faker->word);
                 break;
             case 2:
             case 3:
                 $name = ucwords(implode(' ', $faker->words(3)));
                 break;
         }
         $item = Item::create(['user_id' => $faker->numberBetween(1, 2), 'type_id' => $type, 'product_id' => $faker->numberBetween(1, 3), 'name' => $name, 'desc' => $faker->paragraph(10), 'slug' => '']);
         // Create a new meta model
         $metadata = new ItemMetadata();
         $metadata->fill(['item_id' => $item->id, 'installation' => implode("\r\n\r\n", $faker->paragraphs(3)), 'history' => $faker->paragraph])->save();
         // Determine how many times we're looping through ratings
         $ratingsLoop = $faker->numberBetween(1, 10);
         for ($j = 1; $j < $ratingsLoop; $j++) {
             ItemRating::create(['user_id' => $faker->numberBetween(1, 50), 'item_id' => $item->id, 'rating' => $faker->numberBetween(1, 5)]);
         }
         // Update the total rating
         $item->updateRating();
         // Determine how many times we're looping through comments
         $commentsLoop = $faker->numberBetween(1, 10);
         for ($c = 1; $c < $commentsLoop; $c++) {
             Comment::create(['user_id' => $faker->numberBetween(1, 50), 'item_id' => $item->id, 'content' => $faker->paragraph]);
         }
         // Determine how many times we're looping through files
         $filesLoop = $faker->numberBetween(1, 10);
         for ($f = 1; $f < $filesLoop; $f++) {
             $version = $faker->randomFloat(1, 1, 9);
             $filename = "{$item->user->username}/{$item->slug}-{$version}.zip";
             ItemFile::create(['item_id' => $item->id, 'filename' => $filename, 'version' => $version, 'size' => $faker->numberBetween(1, 999999)]);
         }
         $item->update(['version' => $version]);
         // Determine how many times we're looping through orders
         $ordersLoop = $faker->numberBetween(0, 100);
         for ($o = 1; $o < $ordersLoop; $o++) {
             Order::create(['user_id' => $faker->numberBetween(1, 50), 'item_id' => $item->id, 'file_id' => $faker->numberBetween(1, 400)]);
         }
     }
 }
开发者ID:anodyne,项目名称:xtras,代码行数:50,代码来源:ItemSeeder.php

示例14: add

 public function add()
 {
     $this->load->library('jdf');
     $this->load->helper('form');
     $this->load->library('form_validation');
     $this->load->library("session");
     if ($this->form_validation->run('item/add') === FALSE) {
         $this->load->view("templates/errorForm.php", array("fields" => array('rating', 'isDone', 'task', 'date', 'endTime', 'startTime')));
     } else {
         $item = new Item();
         $task = new Task();
         $user = new User($this->session->getStudentId());
         if ($this->input->post("isDone") == 1) {
             $state = ITEM_STATE_DONE;
         } else {
             $state = ITEM_STATE_UNDONE;
         }
         $task->where("user_id", $this->session->getStudentId());
         $task->where("id", $this->input->post("task"));
         $start = makeTime($this->input->post("date"), $this->input->post("startTime"));
         $end = makeTime($this->input->post("date"), $this->input->post("endTime"));
         try {
             $task->get();
             $item->create($start, $end, $this->input->post("description"), $state, $this->input->post("rating"))->save($user, $task);
             $this->load->view("item/item_created.php", array("item" => $this->setFormat(array($item))));
         } catch (Item_Overlap_With_Other_Item $e) {
             $this->load->view("item/item_error.php");
             Item_Error::Item_Overlap_With_Other_Item();
         } catch (Item_Create_With_Zero_Duration $e) {
             $this->load->view("item/item_error.php");
             Item_Error::Item_Create_With_Zero_Duration();
         } catch (Item_Feedback_Wrong $e) {
             $this->load->view("item/item_error.php");
             Item_Error::Item_Feedback_Wrong();
         } catch (Item_Start_Greater_Than_End_Exception $e) {
             $this->load->view("item/item_error.php");
             Item_Error::Item_Start_Greater_Than_End_Exception();
         } catch (Task_Not_Found $e) {
             $this->load->view("task/task_error.php");
         }
     }
 }
开发者ID:rezachess,项目名称:Planning,代码行数:42,代码来源:Item_controller.php

示例15: add

 public static function add(GatheringDataSourceConfiguration $configuration, $tweet)
 {
     $gathering = $configuration->getGatheringObject();
     try {
         // we wrap this in a try because it MIGHT fail if it's a duplicate
         $item = parent::create($gathering, $configuration->getGatheringDataSourceObject(), date('Y-m-d H:i:s', strtotime($tweet->created_at)), $tweet->text, $tweet->id);
     } catch (Exception $e) {
     }
     if (is_object($item)) {
         $item->assignFeatureAssignments($tweet);
         if (count($tweet->entities->media) > 0 && $tweet->entities->media[0]->type == 'photo') {
             $item->setAutomaticGatheringItemTemplate();
         } else {
             $type = GatheringItemTemplateType::getByHandle('tile');
             $template = GatheringItemTemplate::getByHandle('tweet');
             $item->setGatheringItemTemplate($type, $template);
         }
         return $item;
     }
 }
开发者ID:digideskio,项目名称:concrete5,代码行数:20,代码来源:Twitter.php


注:本文中的Item::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。