created Seeder for initial Database

This commit is contained in:
2025-03-15 19:21:46 +01:00
parent 1104d4b82a
commit a461a23c4b
3 changed files with 72 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\Color;
class ColorSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// Seed predefined Colors
$colors = [
['name' => 'Red', 'hex' => '#FF0000'],
['name' => 'Green', 'hex' => '#00FF00'],
['name' => 'Blue', 'hex' => '#0000FF'],
['name' => 'Yellow', 'hex' => '#FFFF00'],
['name' => 'Orange', 'hex' => '#FFA500'],
['name' => 'Purple', 'hex' => '#800080'],
['name' => 'Pink', 'hex' => '#FFC0CB'],
['name' => 'Brown', 'hex' => '#A52A2A'],
['name' => 'Gray', 'hex' => '#808080'],
['name' => 'Black', 'hex' => '#000000'],
['name' => 'White', 'hex' => '#FFFFFF'],
['name' => 'Gold', 'hex' => '#FFD700'],
['name' => 'Silver', 'hex' => '#C0C0C0'],
['name' => 'Cyan', 'hex' => '#00FFFF']
];
foreach ($colors as $color) {
Color::create($color);
}
}
}