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


PHP Product::insert方法代码示例

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


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

示例1: save

 /**
  * Save product to database
  */
 public function save()
 {
     $data = ['item_id' => $this->item_id, 'shop_id' => $this->shop_id] + $this->data;
     if (!App\Product::where('shop_id', $this->shop_id)->where('item_id', $this->item_id)->update($this->data) && !App\Product::insert($data)) {
         return false;
     }
     $this->id = App\Product::where('shop_id', $this->shop_id)->where('item_id', $this->item_id)->first()->id;
     if (!$this->id) {
         return false;
     }
     foreach ($this->images as $image) {
         if (!App\Image::where('url', $image['url'])->update($image) && !App\Image::insert($image + ['product_id' => $this->id])) {
             return false;
         }
     }
     /*if( isset( $this->params ) )
     		{
     			foreach( $this->params as $param )
     			{
     				if( !App\Param::where( 'param', $param['param'] )->update( $param ) && 
     					!App\Param::insert( $param + [ 'product_id' => $this->id ] ) )
     					return false;
     			}
     		}*/
     return true;
 }
开发者ID:bausano,项目名称:Ebchod,代码行数:29,代码来源:Product.php

示例2: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $data = array(['name' => 'Batman', 'slug' => 'batman', 'description' => 'Lorem ipsum dolor sit amet, consectetur
                     adipisicing elit. Tempore, preferendis!', 'extract' => 'Lorem ipsum dolor sit amet, consectetur
                     adipisicing elit.', 'price' => '70.00', 'image' => 'http://ecx.images-amazon.com/images/I/513yp2SGJrL._SY300_.jpg', 'video' => 'https://www.youtube.com/watch?v=1T__uN5xmC0', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1], ['name' => 'Los vengadores', 'slug' => 'vengadores', 'description' => 'Lorem ipsum dolor sit amet, consectetur
                     adipisicing elit. Tempore, preferendis!', 'extract' => 'Lorem ipsum dolor sit amet, consectetur
                     adipisicing elit.', 'price' => '70.00', 'image' => 'http://cdn.bleedingcool.net/wp-content/uploads/2012/04/avengers-assemble-poster.jpg', 'video' => 'https://www.youtube.com/watch?v=eOrNdBpGMv8', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1], ['name' => 'Fargo', 'slug' => 'fargo', 'description' => 'Lorem ipsum dolor sit amet, consectetur
                     adipisicing elit. Tempore, preferendis!', 'extract' => 'Lorem ipsum dolor sit amet, consectetur
                     adipisicing elit.', 'price' => '70.00', 'image' => 'http://ecx.images-amazon.com/images/I/415341ZXMCL.jpg', 'video' => 'https://www.youtube.com/watch?v=h2tY82z3xXU', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1]);
     Product::insert($data);
 }
开发者ID:Heerou,项目名称:BQMovieStore,代码行数:16,代码来源:ProductTableSeeder.php

示例3: run

 /**
  * Run the database seeds.
  *
  * @return voidLorem ipsum dolor sit amet, consectetur adipisicing elit. Autem quaerat nulla qui officiis voluptas ullam, earum provident voluptatibus deserunt nihil adipisci cumque, nostrum sint rem?
  */
 public function run()
 {
     Product::insert();
 }
开发者ID:kazamax,项目名称:tienda,代码行数:9,代码来源:ProductTableSeeder.php

示例4: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     $data = array(['name' => 'T-shirt super man', 'slug' => 'tshirt-super-man', 'description' => 'The best brands are here. ', 'extract' => 'All sizes', 'price' => 390.99, 'image' => 'http://site.blacksheeptees.com/pics/superman_clarkkent.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1], ['name' => 'SweatShirt Batman', 'slug' => 'sweatshirt-batman', 'description' => 'The best brands are here. ', 'extract' => 'All sizes', 'price' => 390.99, 'image' => 'http://images.superherostuff.com/image-tsbathoodie-0-watermark.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1], ['name' => 'T-shirt geek', 'slug' => 'geek-tshirt', 'description' => 'If you want to see and eat the world', 'extract' => 'wear comfortable', 'price' => 390.99, 'image' => 'http://cdn2.notonthehighstreet.com/system/product_images/images/001/979/640/preview_unisex-minty-geek-tshirt.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 2], ['name' => 'cup geek', 'slug' => 'geek-cup', 'description' => 'If you want to see and eat the world', 'extract' => 'wear comfortable', 'price' => 390.99, 'image' => 'https://shechive.files.wordpress.com/2013/04/geek-products-11.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 2], ['name' => 'Lentes', 'slug' => 'geek-glasses', 'description' => 'If you want to see and eat the world', 'extract' => 'Enhance your eye-sight', 'price' => 390.99, 'image' => 'http://sartorialmale.com/wp-content/uploads/2011/01/geek-chic-glasses.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 2]);
     Product::insert($data);
 }
开发者ID:AcarMeel,项目名称:store,代码行数:11,代码来源:ProductTableSeeder.php

示例5: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $data = array(['name' => 'fifa16', 'slug' => 'fifa-2016', 'description' => 'juego fifa 2016', 'extract' => 'nuevo juego de futbol de konami', 'price' => 40000, 'image' => 'http://www.zmart.cl/Productos/SKU/2015/09/01/PS4G0204_201591181537_b.png', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1], ['name' => 'joystick ps4', 'slug' => 'joystick-ps4', 'description' => 'mando para ps4 inhalambrico color negro', 'extract' => 'mando inhalambrico sin pilas', 'price' => 40000, 'image' => 'http://www.zmart.cl/Productos/ps4_dualshock4_b.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 2], ['name' => 'consola ps4', 'slug' => 'consola-ps4', 'description' => 'consola de juego ps4 edicion glacier', 'extract' => 'consola edicion glacier', 'price' => 370000, 'image' => 'http://www.zmart.cl/Productos/SKU/2015/06/30/File_2015630113321_s.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 3], ['name' => 'Star Wars Battlefront PC (DIGITAL)', 'slug' => 'star-wars', 'description' => '¡Este 2015 Star Wars regresa a la pantalla grande...y debuta en la nueva generación de videojuegos con el regreso de la saga "BattleFront"!', 'extract' => 'nuevo juego de pc/play station/xbox one.', 'price' => 38990, 'image' => 'http://www.zmart.cl/Productos/SKU/2015/04/17/JUE1313_201541717152_b.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1], ['name' => 'Fallout 4 ps4', 'slug' => 'fallout-4', 'description' => '¡La serie de RPG post-apocalíptico más popular del mundo debuta en la nueva generación de videojuegos!', 'extract' => 'Fallout 4 es la esperada secuela de la saga de rol', 'price' => 45000, 'image' => 'http://www.zmart.cl/Productos/SKU/2015/06/03/PS4G0206_201563135650_b.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1], ['name' => 'Rise of the Tomb Raider ', 'slug' => 'rise-of-the-tomb-raider', 'description' => '¡Lara Croft regresa en una aventura épica que continúa con la reinventada saga de aventura y supervivencia!', 'extract' => 'una aventura cinemática de supervivencia donde te unirás a Lara Croft', 'price' => 44990, 'image' => 'http://www.zmart.cl/Productos/SKU/2015/07/23/XBONEG096_2015723141018_b.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1], ['name' => 'Guitar Hero Live', 'slug' => 'guitar-hero-live ', 'description' => '¡GUITAR HERO REGRESA CON UNA EXPERIENCIA DE MÚSICA EN VIVO!', 'extract' => '¡CON GUITAR HERO LIVE, TÚ ERES LA ESTRELLA DE ROCK!', 'price' => 89990, 'image' => 'http://www.zmart.cl/Productos/SKU/2015/11/10/PS4G0187_20151110125159_b.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1], ['name' => 'Rainbow Six Siege ', 'slug' => 'rainbow-six-siege ', 'description' => '¡La serie de FPS táctico por excelencia regresa en una nueva y espectacular entrega!', 'extract' => 'La guerra contra el terrorismo en la nueva generación de videojuegos', 'price' => 45000, 'image' => 'http://www.zmart.cl/Productos/SKU/2015/03/16/PS4G0096_2015316163834_b.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1], ['name' => 'Call of Duty: Black Ops III', 'slug' => 'black-ops-3', 'description' => '¡La línea entre arma y soldado es borrada completamente en la tercera entrega de Call of Duty: Black Ops!', 'extract' => 'Entra al campo de batalla del futuroe de la tecnología', 'price' => 44990, 'image' => 'http://www.zmart.cl/Productos/SKU/2015/04/27/PS4G0185_201542710224_b.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1], ['name' => 'WRC 5 ', 'slug' => 'WRC-5', 'description' => 'El FIFA World Rally Championship (WRC) reúne a los mejores pilotos conduciendo los vehículos basados en la serie con las condiciones climáticas más difíciles y variadas del mundo. En 2015, las carreras de esta increíble aventura pasan por 13 rallies en 14 países en todo tipo de superficie: de las carreras forestales nevadas a los terrenos montañosos pedregosos.', 'extract' => 'la mejor experiencia de juego a los aficionados de rallye y de juegos de carrera.', 'price' => 34990, 'image' => 'http://www.zmart.cl/Productos/SKU/2015/09/21/XBONEG238_2015921103324_b.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1], ['name' => 'Just Cause 3 XBOX ONE', 'slug' => 'just-cause-3', 'description' => '¡Rico “El Escorpión” Rodríguez regresa al mundo de los videojuegos para sembrar el caos!', 'extract' => 'Lucha por liberar a tu patria de un dictador.', 'price' => 46000, 'image' => 'http://www.zmart.cl/Productos/SKU/2015/05/04/XBONEG127_201554124143_b.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1], ['name' => 'Minecraft: Story Mode Season Disc', 'slug' => 'minecraft-story-mode-season-disc', 'description' => 'Minecraft : Story Mode es una aventura jugable basada en el popular juego donde tú eres la estrella y las decisiones que tomes influyen en cómo la historia será contada.', 'extract' => 'El Exitoso juego de pc ahora en Xbox', 'price' => 30000, 'image' => 'http://www.zmart.cl/Productos/SKU/2015/10/01/XBONEG231_201510113304_b.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1], ['name' => 'Mario Tennis Ultra Smash', 'slug' => 'mario-tennis-ultra-smash', 'description' => 'Mario y compañía sirven para ganar el partido en Mario Tennis: Ultra Smash, solo para Wii U.', 'extract' => 'Mario Tennis: Ultra Smash para Wii U.', 'price' => 39990, 'image' => 'http://www.zmart.cl/Productos/SKU/2015/11/12/WIUG0148_20151112121613_b.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1], ['name' => 'Xbox One 500GB Edición Fifa 16', 'slug' => 'xbox-one', 'description' => 'Xbox One es la octava generación de consolas de videojuegos. Actualmente es de las mejores consolas del mercado por sus capacidades y características técnicas. Sin olvidar por sus juegos de última generación con la mejor tecnología. ', 'extract' => 'La gran primicia de poder jugar todos los juegos de Xbox One y de Xbox 360 en una consola', 'price' => 319990, 'image' => 'https://media.linio.cl/p/microsoft-xbox-8626-805216-1-product.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 3], ['name' => 'Consola WiiU Deluxe 32GB', 'slug' => 'consola-wiiu', 'description' => 'Por primera vez, experimenta tu mundo de Nintendo favorito con una cristalina alta definición. Conecta a tu pantalla y juega en HD. Compartible con 1080p, 1080i, 720p, 480p y 480i. Cables compatibles: HDMI™, cable por componentes de Wii, cable de video compuesto Wii (S-Video) y cable A/V estéreo de Wii.', 'extract' => 'Incluido con cada consola Wii U, el nuevo y revolucionario mandoZWii U.', 'price' => 280000, 'image' => 'https://media.linio.cl/p/nintendo-6490-65249-1-product.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 3]);
     Product::insert($data);
 }
开发者ID:CodigoCarmesi,项目名称:tienda_juegos,代码行数:10,代码来源:ProductTableSeeder.php

示例6: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $data = array(['name' => 'Playera 1', 'slug' => 'playera-1', 'description' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Delectus repellendus doloribus molestias odio nisi! Aspernatur eos saepe veniam quibusdam totam.', 'extract' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.', 'price' => 275.0, 'image' => 'http://www.truffleshuffle.co.uk/store/images_high_res/Mens_Red_Batman_Graffiti_Logo_T_Shirt_hi_res.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1], ['name' => 'Playera 2', 'slug' => 'playera-2', 'description' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Delectus repellendus doloribus molestias odio nisi! Aspernatur eos saepe veniam quibusdam totam.', 'extract' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.', 'price' => 255.0, 'image' => 'http://www.truffleshuffle.co.uk/store/images_high_res/Mens_Blue_Distressed_Superman_Logo_T_Shirt_hi_res.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1], ['name' => 'Playera 3', 'slug' => 'playera-3', 'description' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Delectus repellendus doloribus molestias odio nisi! Aspernatur eos saepe veniam quibusdam totam.', 'extract' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.', 'price' => 300.0, 'image' => 'http://img5a.flixcart.com/image/t-shirt/f/g/q/fsbk-bruce-lee-sayitloud-xl-700x700-imadtkffxfhgsday.jpeg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1], ['name' => 'Playera 4', 'slug' => 'playera-4', 'description' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Delectus repellendus doloribus molestias odio nisi! Aspernatur eos saepe veniam quibusdam totam.', 'extract' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.', 'price' => 475.0, 'image' => 'http://rlv.zcache.com/funny_computer_geek_t_shirt_tshirt-r537052a6a7b94b028e47b274c099fe24_804g5_324.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 2], ['name' => 'Playera 5', 'slug' => 'playera-5', 'description' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Delectus repellendus doloribus molestias odio nisi! Aspernatur eos saepe veniam quibusdam totam.', 'extract' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.', 'price' => 280.0, 'image' => 'https://www.nerdyshirts.com/media/catalog/product/cache/1/image/400x445/9df78eab33525d08d6e5fb8d27136e95/g/e/geek_1.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 2], ['name' => 'Playera 6', 'slug' => 'playera-6', 'description' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Delectus repellendus doloribus molestias odio nisi! Aspernatur eos saepe veniam quibusdam totam.', 'extract' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.', 'price' => 275.0, 'image' => 'http://bobstshirtcompany.net/media/catalog/product/cache/1/image/650x650/9df78eab33525d08d6e5fb8d27136e95/i/_/i_know_html.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 2], ['name' => 'Playera 7', 'slug' => 'playera-7', 'description' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Delectus repellendus doloribus molestias odio nisi! Aspernatur eos saepe veniam quibusdam totam.', 'extract' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.', 'price' => 275.0, 'image' => 'http://www.koszulkomat.eu/images4/preview/14/1430_7-0.png', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1], ['name' => 'Playera 8', 'slug' => 'playera-8', 'description' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Delectus repellendus doloribus molestias odio nisi! Aspernatur eos saepe veniam quibusdam totam.', 'extract' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.', 'price' => 275.0, 'image' => 'http://cdn.somethinggeeky.com/assets/images/products/amazonlarge/4ffed02898033.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 2]);
     Product::insert($data);
 }
开发者ID:primitivorm,项目名称:tienda,代码行数:10,代码来源:ProductTableSeeder.php

示例7: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $data = array(['name' => 'Playera 1', 'slug' => 'playera-1', 'description' => 'Lorem Ipsum es simplemente el texto de relleno de las imprentas y archivos de texto.', 'extract' => 'Lorem Ipsum es simplemente el texto de', 'price' => 275.0, 'image' => 'http://static.mercadoshops.com/playeras-de-superheroes_iZ51XvZxXpZ1XfZ75420780-418096547-1.jpgXsZ75420780xIM.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1], ['name' => 'Playera 2', 'slug' => 'playera-2', 'description' => 'Lorem Ipsum es simplemente el texto de relleno de las imprentas y archivos de texto.', 'extract' => 'Lorem Ipsum es simplemente el texto de relleno de', 'price' => 475.0, 'image' => 'http://static.mercadoshops.com/playeras-de-superheroes_iZ51XvZxXpZ4XfZ75420780-418096547-4.jpgXsZ75420780xIM.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1]);
     Product::insert($data);
 }
开发者ID:edgarxene,项目名称:Store-X,代码行数:10,代码来源:ProductTableSeeders.php

示例8: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $data = array(['name' => 'Led One', 'slug' => 'led', 'description' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad!', 'extract' => 'Lorem ipsum dolor sit amet.', 'price' => 1200.5, 'image' => 'http://www.ovalamp.com/images/thumbs/Foco-Led-Azul-7954-Led-Lenser_2.jpeg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1], ['name' => 'Led Two', 'slug' => 'led T', 'description' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad!', 'extract' => 'Lorem ipsum dolor sit amet.', 'price' => 1300.5, 'image' => 'http://grupogeek.com/wp-content/uploads/2013/10/lifi1.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1], ['name' => 'Led Three', 'slug' => 'led TH', 'description' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad!', 'extract' => 'Lorem ipsum dolor sit amet.', 'price' => 1300.5, 'image' => 'http://cdn1.anunico-st.com/foto/2011/09/foco_37_led_2w_ahorrador_energia_luz_deslumbrante_127-4e84ec19563801156ff501b68.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1], ['name' => 'Led Four', 'slug' => 'ledTH', 'description' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad!', 'extract' => 'Lorem ipsum dolor sit amet.', 'price' => 1300.5, 'image' => 'http://www.blacktronics.com/wp-content/uploads/2013/11/foco-led-232x300.jpg', 'visible' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'category_id' => 1]);
     Product::insert($data);
 }
开发者ID:aleksAE,项目名称:Store-Laravel5.1,代码行数:10,代码来源:ProductTableSeeder.php


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