コード例 #1
0
 public function run()
 {
     // Uncomment the below to wipe the table clean before populating
     DB::table('products_globex')->delete();
     $faker = $this->getFaker();
     $categories = App\Category::allLeaves()->get();
     $category_count = count($categories);
     for ($i = 0; $i < 200; $i++) {
         $product = App\Product::create(['title' => $faker->sentence(rand(1, 3)), 'price' => rand(5, 50000), 'description' => $faker->sentence(), 'brand' => $faker->company, 'category_id' => $categories[rand(0, $category_count - 1)]->id]);
         $product->images()->create(['url' => '/img/noImage.jpg']);
         $globex = App\Globex::create(['stock' => rand(0, 100), 'price_rule_id' => rand(1, 10)]);
         $globex->product()->save($product);
     }
 }
コード例 #2
0
 public function run()
 {
     // Uncomment the below to wipe the table clean before populating
     DB::table('products_ads')->delete();
     $faker = $this->getFaker();
     $categories = App\Category::allLeaves()->get();
     $category_count = count($categories);
     for ($i = 0; $i < 100; $i++) {
         $product = App\Product::create(['category_id' => $categories[rand(0, $category_count - 1)]->id, 'title' => $faker->sentence(), 'description' => $faker->paragraph(), 'price' => rand(1, 50000), 'brand' => $faker->company]);
         $product->images()->create(['url' => '/img/noImage.jpg']);
         $ad = App\Advertisement::create(['customer_id' => rand(1, 100), 'name' => $faker->name, 'pin' => $faker->postcode, 'address' => $faker->address, 'emirate_id' => rand(1, 7), 'phone' => $faker->phoneNumber]);
         $ad->product()->save($product);
     }
 }
コード例 #3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     DB::table('users')->delete();
     $users = array();
     // Loop through each user above and create the record for them in the database
     foreach ($users as $user) {
         App\User::create($user);
     }
     DB::table('product')->delete();
     $products = array(['name' => 'Leki Spin Ngt1 V2 Nordic Walking Pole Pair 100-130 cm Nordic walking', 'brand' => 'Leki', 'description' => '<b>DescriptionFeatures:</b><br><ul><li>Trigger 1 glide zone.</li><li>Match size (S-M-L strap).</li><li>Super lock.</li><li>Diamond tip.</li><li>Power grip.</li><li>Ultrasonic finish.</li></ul><br><b>Specifications:</b><br><ul><li>Lengths: 100 - 130 cm.</li></ul>', 'price' => 68.95, 'imageUrl' => 'https://drms3v40st3o6.cloudfront.net/f/59/593363/asolo-escape-ii-trident-pair.jpg'], ['name' => 'Asolo Escape II Trident Pair', 'brand' => 'Asolo', 'description' => '<b>Specifications:</b><ul><li>Twistlock</li><li>Trident fast release</li><li>2 thin tube segments: 14/16mm sections</li><li>Sections anodized</li><li>Combines Twistlock and Quicklock </li><li>Material: Alu7075</li><li>Size: 90-135cm</li><li>Weight: 220 g</li></ul>', 'price' => 73.95999999999999, 'imageUrl' => 'https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcTu0VzMGje4G0pTJ7403WHpqKOz5Z9jCrqgdZaWfoTEoCIPiigT&usqp=CAE']);
     foreach ($products as $product) {
         App\Product::create($product);
     }
     Model::reguard();
 }
コード例 #4
0
ファイル: DatabaseSeeder.php プロジェクト: e11en/allocatie
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     App\Product::create(array('proArticleNumber' => '104018585', 'proType' => 'Apple iPhone 5C 8GB', 'proColor' => 'White', 'proAvailable' => 'EOL'));
     App\Product::create(array('proArticleNumber' => '104018584', 'proType' => 'Apple iPhone 5C 8GB', 'proColor' => 'Blue', 'proAvailable' => 'EOL'));
     App\Product::create(array('proArticleNumber' => '104025582', 'proType' => 'HTC One M9', 'proColor' => 'Gold', 'proAvailable' => 'EOL'));
     App\Product::create(array('proArticleNumber' => '104026210', 'proType' => 'Huawei P8', 'proColor' => 'Gold', 'proAvailable' => '2'));
 }