Files
Additional/database/seeders/PrintStockSeeder.php
T
twotalesanimation 6de01c13c5 New Initial Commit
2025-12-09 12:04:54 +02:00

64 lines
1.9 KiB
PHP

<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\PrintStock;
use App\Models\Product;
class PrintStockSeeder extends Seeder
{
public function run(): void
{
$stocks = [
[
'name' => 'Standard Matte',
'description' => 'Classic matte finish wallpaper. Professional appearance with subtle texture.',
'cost_per_meter' => 8.50,
'cost_per_m2' => 85.00,
'type' => 'both'
],
[
'name' => 'Premium Silk',
'description' => 'Smooth silk finish with subtle sheen. Elegant and durable.',
'cost_per_meter' => 12.50,
'cost_per_m2' => 125.00,
'type' => 'both'
],
[
'name' => 'Luxury Velvet',
'description' => 'Rich velvet texture with premium feel. High-end luxury option.',
'cost_per_meter' => 16.00,
'cost_per_m2' => 160.00,
'type' => 'both'
],
[
'name' => 'Canvas',
'description' => 'Textured canvas finish. Great for artistic designs.',
'cost_per_meter' => 14.00,
'cost_per_m2' => 140.00,
'type' => 'both'
],
[
'name' => 'Glossy',
'description' => 'Shiny glossy finish. Vibrant colors and easy to clean.',
'cost_per_meter' => 10.00,
'cost_per_m2' => 100.00,
'type' => 'both'
]
];
foreach ($stocks as $stock) {
PrintStock::create($stock);
}
// Attach all stocks to all products
$products = Product::all();
$stockIds = PrintStock::pluck('id')->toArray();
foreach ($products as $product) {
$product->printStocks()->sync($stockIds);
}
}
}