| Path : /var/www/html/jewelry-pos/database/seeders/ |
|
B-Con CMD Config cPanel C-Rdp D-Log Info Jump Mass Ransom Symlink vHost Zone-H |
| Current File : /var/www/html/jewelry-pos/database/seeders/SaleSeeder.php |
<?php
namespace Database\Seeders;
use App\Models\Product;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class SaleSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$products = Product::all();
foreach($products as $product) {
DB::table('sales')->insert([
'product_id' => $product->id,
'part_number' => $product->part_number,
'name' => $product->name,
'cost' => $product->cost,
// 'is_active' => $product->is_active,
'description' => $product->description,
'image' => $product->image,
'weight' => $product->weight,
'product_category_id' => $product->product_category_id,
'user_id' => $product->user_id,
'created_at' => $product->created_at,
'wages' => $product->wages,
'invoice_no' => random_int(000000000,999999999),
'qty' => $product->qty,
'diamond_size' => $product->diamond_size,
]);
}
}
}