Initial Commit

This commit is contained in:
dann4624
2022-09-28 09:38:08 +02:00
parent cac476f80f
commit 2d04a269e6
355 changed files with 52166 additions and 25 deletions
+47
View File
@@ -0,0 +1,47 @@
<?php
namespace Database\Seeders;
use App\Models\Brand;
use App\Models\Product;
use App\Models\ProductCategory;
use App\Models\ProductModel;
use App\Models\ProductSubcategory;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class ProductSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$items = [
[
'product_category_id' => ProductCategory::where('name','=','Laptop')->first()->id,
'product_subcategory_id' => ProductSubcategory::where('name','=','Server Rum')->first()->id,
'brand_id' => Brand::where('name','=','Test Brand')->first()->id,
'product_model_id' => ProductModel::where('name','=','Test Model')->first()->id,
'name' => 'Test Product',
'description' => "Test Description",
'total' => 100,
'barcode' => "Test.Product.0001",
],
[
'product_category_id' => ProductCategory::where('name','=','Laptop')->first()->id,
'brand_id' => Brand::where('name','=','Test Brand')->first()->id,
'product_model_id' => ProductModel::where('name','=','Test Model')->first()->id,
'name' => 'Test Product 2',
'description' => "Test Description 2",
'total' => 100,
'barcode' => "Test.Product.0002",
],
];
foreach ($items as $item) {
Product::create($item);
}
}
}