mirror of
https://github.com/ericasch6/scrum-poker-internal.git
synced 2026-10-13 20:12:10 +00:00
initial Setup and data structure
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
use WithoutModelEvents;
|
||||
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$this->call([
|
||||
DeckSeeder::class,
|
||||
]);
|
||||
|
||||
User::factory()->create([
|
||||
'name' => 'Test User',
|
||||
'email' => 'test@example.com',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Deck;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DeckSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$decks = [
|
||||
[
|
||||
'name' => 'Fibonacci',
|
||||
'cards' => [
|
||||
['key' => '0', 'label' => '0'],
|
||||
['key' => '1', 'label' => '1'],
|
||||
['key' => '2', 'label' => '2'],
|
||||
['key' => '3', 'label' => '3'],
|
||||
['key' => '5', 'label' => '5'],
|
||||
['key' => '8', 'label' => '8'],
|
||||
['key' => '13', 'label' => '13'],
|
||||
['key' => '21', 'label' => '21'],
|
||||
['key' => 'unknown', 'label' => '?'],
|
||||
['key' => 'coffee', 'label' => '☕'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'T-Shirt Sizes',
|
||||
'cards' => [
|
||||
['key' => 'xs', 'label' => 'XS'],
|
||||
['key' => 's', 'label' => 'S'],
|
||||
['key' => 'm', 'label' => 'M'],
|
||||
['key' => 'l', 'label' => 'L'],
|
||||
['key' => 'xl', 'label' => 'XL'],
|
||||
['key' => 'unknown', 'label' => '?'],
|
||||
['key' => 'coffee', 'label' => '☕'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'Powers of Two',
|
||||
'cards' => [
|
||||
['key' => '0', 'label' => '0'],
|
||||
['key' => '1', 'label' => '1'],
|
||||
['key' => '2', 'label' => '2'],
|
||||
['key' => '4', 'label' => '4'],
|
||||
['key' => '8', 'label' => '8'],
|
||||
['key' => '16', 'label' => '16'],
|
||||
['key' => '32', 'label' => '32'],
|
||||
['key' => 'unknown', 'label' => '?'],
|
||||
['key' => 'coffee', 'label' => '☕'],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($decks as $definition) {
|
||||
$deck = Deck::query()
|
||||
->whereNull('user_id')
|
||||
->where('is_system', true)
|
||||
->where('name', $definition['name'])
|
||||
->first() ?? new Deck();
|
||||
|
||||
$deck->forceFill([
|
||||
'user_id' => null,
|
||||
'name' => $definition['name'],
|
||||
'cards' => $definition['cards'],
|
||||
'is_system' => true,
|
||||
])->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user