added media, mutation events, agent instructions
This commit is contained in:
@@ -18,7 +18,8 @@ class ChatFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
'chatable_type' => 'App\\Models\\Dynamic',
|
||||
'chatable_id' => 1,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,14 @@ class DynamicFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
'name' => $this->faker->randomElement([
|
||||
'The Velvet Sanctuary',
|
||||
'Obsidian Household Agreement',
|
||||
'Crimson Castle Protocol',
|
||||
'Dungeon Master-Sub Board',
|
||||
'Coffee Club Ledger'
|
||||
]),
|
||||
'rules' => "1. All rules must be strictly adhered to.\n2. Scores must be updated after every task.\n3. Disputed scores can be discussed in the dedicated chat.",
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Ledger;
|
||||
use App\Models\Dynamic;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
@@ -18,7 +19,17 @@ class LedgerFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
'dynamic_id' => Dynamic::factory(),
|
||||
'name' => $this->faker->randomElement([
|
||||
'Curfew Compliance',
|
||||
'Worship & Praise',
|
||||
'Dungeon Cleaning',
|
||||
'Silence Protocol',
|
||||
'Task Completion',
|
||||
'Tribute Points'
|
||||
]),
|
||||
'rules' => 'Scores are added by Doms and subtracted for protocol breaches.',
|
||||
'score' => 0,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Message;
|
||||
use App\Models\Chat;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
@@ -18,7 +20,9 @@ class MessageFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
'chat_id' => Chat::factory(),
|
||||
'user_id' => User::factory(),
|
||||
'content' => $this->faker->sentence(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Mutation;
|
||||
use App\Models\Ledger;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
@@ -18,7 +20,12 @@ class MutationFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
'ledger_id' => Ledger::factory(),
|
||||
'user_id' => User::factory(),
|
||||
'type' => $this->faker->randomElement(['addition', 'subtraction', 'reward', 'penalty']),
|
||||
'amount' => $this->faker->randomElement([5, 10, 15, -5, -10, -25]),
|
||||
'description' => $this->faker->sentence(),
|
||||
'status' => $this->faker->randomElement(['approved', 'pending', 'rejected']),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void {
|
||||
Schema::create('media', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->morphs('mediable'); // mediable_type, mediable_id
|
||||
$table->string('file_path');
|
||||
$table->string('file_name');
|
||||
$table->string('mime_type');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void {
|
||||
Schema::dropIfExists('media');
|
||||
}
|
||||
};
|
||||
@@ -3,23 +3,328 @@
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use App\Models\Dynamic;
|
||||
use App\Models\Ledger;
|
||||
use App\Models\Mutation;
|
||||
use App\Models\Message;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
use WithoutModelEvents;
|
||||
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// User::factory(10)->create();
|
||||
DB::transaction(function () {
|
||||
// 1. Create Core Users
|
||||
$testUser = User::factory()->create([
|
||||
'name' => 'Test User',
|
||||
'email' => 'test@example.com',
|
||||
'password' => Hash::make('password'),
|
||||
]);
|
||||
|
||||
User::factory()->create([
|
||||
'name' => 'Test User',
|
||||
'email' => 'test@example.com',
|
||||
]);
|
||||
$alice = User::factory()->create([
|
||||
'name' => 'Domina Alice',
|
||||
'email' => 'alice@example.com',
|
||||
'password' => Hash::make('password'),
|
||||
]);
|
||||
|
||||
$bob = User::factory()->create([
|
||||
'name' => 'Submissive Bob',
|
||||
'email' => 'bob@example.com',
|
||||
'password' => Hash::make('password'),
|
||||
]);
|
||||
|
||||
$charles = User::factory()->create([
|
||||
'name' => 'Master Charles',
|
||||
'email' => 'charles@example.com',
|
||||
'password' => Hash::make('password'),
|
||||
]);
|
||||
|
||||
// Create some random general users
|
||||
User::factory(5)->create();
|
||||
|
||||
// ----------------------------------------------------
|
||||
// 2. Seed Dynamic 1: The Velvet Sanctuary
|
||||
// ----------------------------------------------------
|
||||
$velvetSanctuary = Dynamic::create([
|
||||
'name' => 'The Velvet Sanctuary',
|
||||
'rules' => "1. Respect limits and boundaries at all times.\n2. Submit daily logs for curfew and chores.\n3. Maintain proper protocol in the general discussion.",
|
||||
]);
|
||||
|
||||
// Add participants (Test User is owner, Alice is owner, Bob is submissive/participant)
|
||||
$velvetSanctuary->participants()->attach($testUser->id, ['role' => 'owner']);
|
||||
$velvetSanctuary->participants()->attach($alice->id, ['role' => 'owner']);
|
||||
$velvetSanctuary->participants()->attach($bob->id, ['role' => 'participant']);
|
||||
|
||||
// Chat has been auto-created by the booted hook on Dynamic
|
||||
$velvetChat = $velvetSanctuary->chat;
|
||||
|
||||
// Seed Dynamic Chat Messages
|
||||
Message::create([
|
||||
'chat_id' => $velvetChat->id,
|
||||
'user_id' => $alice->id,
|
||||
'content' => 'Good morning everyone. Bob, please ensure the Obsidian room is polished before 4 PM.',
|
||||
]);
|
||||
|
||||
Message::create([
|
||||
'chat_id' => $velvetChat->id,
|
||||
'user_id' => $testUser->id,
|
||||
'content' => 'I will review the curfew log later today.',
|
||||
]);
|
||||
|
||||
Message::create([
|
||||
'chat_id' => $velvetChat->id,
|
||||
'user_id' => $bob->id,
|
||||
'content' => "Yes, Sir. Yes, Ma'am. I am starting on the chores now.",
|
||||
]);
|
||||
|
||||
Message::create([
|
||||
'chat_id' => $velvetChat->id,
|
||||
'user_id' => $testUser->id,
|
||||
'content' => 'Excellent. Keep up the high standard.',
|
||||
]);
|
||||
|
||||
// Add Ledgers
|
||||
$curfewLedger = Ledger::create([
|
||||
'dynamic_id' => $velvetSanctuary->id,
|
||||
'name' => 'Curfew Compliance',
|
||||
'rules' => 'Must be in bed and checked in by 11:00 PM.',
|
||||
'score' => 35,
|
||||
]);
|
||||
|
||||
$cleaningLedger = Ledger::create([
|
||||
'dynamic_id' => $velvetSanctuary->id,
|
||||
'name' => 'Dungeon Cleaning',
|
||||
'rules' => 'Earn +10 to +20 points for cleaning/setup. Penalty -10 for disorganization.',
|
||||
'score' => 45,
|
||||
]);
|
||||
|
||||
$etiquetteLedger = Ledger::create([
|
||||
'dynamic_id' => $velvetSanctuary->id,
|
||||
'name' => 'Protocol & Etiquette',
|
||||
'rules' => 'Address others by correct titles. -5 per infraction.',
|
||||
'score' => -15,
|
||||
]);
|
||||
|
||||
// Seed Curfew Mutations
|
||||
Mutation::create([
|
||||
'ledger_id' => $curfewLedger->id,
|
||||
'user_id' => $bob->id,
|
||||
'type' => 'reward',
|
||||
'amount' => 10,
|
||||
'description' => 'Checked in by 10:45 PM on Friday',
|
||||
'status' => 'approved',
|
||||
]);
|
||||
|
||||
Mutation::create([
|
||||
'ledger_id' => $curfewLedger->id,
|
||||
'user_id' => $bob->id,
|
||||
'type' => 'reward',
|
||||
'amount' => 15,
|
||||
'description' => 'Checked in by 10:30 PM on Saturday',
|
||||
'status' => 'approved',
|
||||
]);
|
||||
|
||||
Mutation::create([
|
||||
'ledger_id' => $curfewLedger->id,
|
||||
'user_id' => $bob->id,
|
||||
'type' => 'reward',
|
||||
'amount' => 10,
|
||||
'description' => 'Checked in by 10:50 PM on Sunday',
|
||||
'status' => 'approved',
|
||||
]);
|
||||
|
||||
// Seed Cleaning Mutations
|
||||
Mutation::create([
|
||||
'ledger_id' => $cleaningLedger->id,
|
||||
'user_id' => $bob->id,
|
||||
'type' => 'reward',
|
||||
'amount' => 15,
|
||||
'description' => 'Deep cleaning of the main chamber',
|
||||
'status' => 'approved',
|
||||
]);
|
||||
|
||||
Mutation::create([
|
||||
'ledger_id' => $cleaningLedger->id,
|
||||
'user_id' => $bob->id,
|
||||
'type' => 'reward',
|
||||
'amount' => 20,
|
||||
'description' => 'Arranged gear rack and polished leather accessories',
|
||||
'status' => 'approved',
|
||||
]);
|
||||
|
||||
Mutation::create([
|
||||
'ledger_id' => $cleaningLedger->id,
|
||||
'user_id' => $bob->id,
|
||||
'type' => 'reward',
|
||||
'amount' => 10,
|
||||
'description' => 'Mopped obsidian floors',
|
||||
'status' => 'approved',
|
||||
]);
|
||||
|
||||
Mutation::create([
|
||||
'ledger_id' => $cleaningLedger->id,
|
||||
'user_id' => $bob->id,
|
||||
'type' => 'penalty',
|
||||
'amount' => -10,
|
||||
'description' => 'Left keys in the locks unmonitored',
|
||||
'status' => 'approved',
|
||||
]);
|
||||
|
||||
// Seed Pending Mutation with its own Chat Messages!
|
||||
$pendingMutation = Mutation::create([
|
||||
'ledger_id' => $cleaningLedger->id,
|
||||
'user_id' => $bob->id,
|
||||
'type' => 'addition',
|
||||
'amount' => 10,
|
||||
'description' => 'Weekly chore submission - dusting shelves',
|
||||
'status' => 'pending',
|
||||
]);
|
||||
|
||||
// Pending mutation chat messages (chat is auto-created on booted)
|
||||
$pendingMutationChat = $pendingMutation->chat;
|
||||
|
||||
Message::create([
|
||||
'chat_id' => $pendingMutationChat->id,
|
||||
'user_id' => $bob->id,
|
||||
'content' => 'I have finished the shelves. Please approve when convenient.',
|
||||
]);
|
||||
|
||||
Message::create([
|
||||
'chat_id' => $pendingMutationChat->id,
|
||||
'user_id' => $alice->id,
|
||||
'content' => "I checked them; there is still some dust on the top shelf. I'll leave this pending until it's perfect.",
|
||||
]);
|
||||
|
||||
Message::create([
|
||||
'chat_id' => $pendingMutationChat->id,
|
||||
'user_id' => $bob->id,
|
||||
'content' => 'Apologies, Ma\'am. I will re-wipe the top section immediately!',
|
||||
]);
|
||||
|
||||
// Seed Etiquette Mutations
|
||||
Mutation::create([
|
||||
'ledger_id' => $etiquetteLedger->id,
|
||||
'user_id' => $bob->id,
|
||||
'type' => 'penalty',
|
||||
'amount' => -5,
|
||||
'description' => 'Interrupted Domina Alice during daily instructions',
|
||||
'status' => 'approved',
|
||||
]);
|
||||
|
||||
Mutation::create([
|
||||
'ledger_id' => $etiquetteLedger->id,
|
||||
'user_id' => $bob->id,
|
||||
'type' => 'penalty',
|
||||
'amount' => -10,
|
||||
'description' => 'Forgot correct posture during morning roll call',
|
||||
'status' => 'approved',
|
||||
]);
|
||||
|
||||
Mutation::create([
|
||||
'ledger_id' => $etiquetteLedger->id,
|
||||
'user_id' => $bob->id,
|
||||
'type' => 'penalty',
|
||||
'amount' => -5,
|
||||
'description' => 'Spoke out of turn in general chat',
|
||||
'status' => 'approved',
|
||||
]);
|
||||
|
||||
Mutation::create([
|
||||
'ledger_id' => $etiquetteLedger->id,
|
||||
'user_id' => $bob->id,
|
||||
'type' => 'reward',
|
||||
'amount' => 5,
|
||||
'description' => 'Excellent reciting of the house codes',
|
||||
'status' => 'approved',
|
||||
]);
|
||||
|
||||
|
||||
// ----------------------------------------------------
|
||||
// 3. Seed Dynamic 2: Obsidian Household Agreement
|
||||
// ----------------------------------------------------
|
||||
$obsidianHousehold = Dynamic::create([
|
||||
'name' => 'Obsidian Household Agreement',
|
||||
'rules' => "1. All residents must do their fair share of maintenance.\n2. Coffee machine must be refilled immediately when empty.",
|
||||
]);
|
||||
|
||||
$obsidianHousehold->participants()->attach($alice->id, ['role' => 'owner']);
|
||||
$obsidianHousehold->participants()->attach($testUser->id, ['role' => 'participant']);
|
||||
$obsidianHousehold->participants()->attach($charles->id, ['role' => 'participant']);
|
||||
|
||||
$obsidianChat = $obsidianHousehold->chat;
|
||||
|
||||
Message::create([
|
||||
'chat_id' => $obsidianChat->id,
|
||||
'user_id' => $alice->id,
|
||||
'content' => "Who finished the coffee beans and didn't put them on the shopping list?",
|
||||
]);
|
||||
|
||||
Message::create([
|
||||
'chat_id' => $obsidianChat->id,
|
||||
'user_id' => $charles->id,
|
||||
'content' => "Wasn't me, I only drink tea.",
|
||||
]);
|
||||
|
||||
Message::create([
|
||||
'chat_id' => $obsidianChat->id,
|
||||
'user_id' => $testUser->id,
|
||||
'content' => 'My apologies! I did refill the hopper, but forgot to list the replacement bag. I will buy a new pack tonight.',
|
||||
]);
|
||||
|
||||
Message::create([
|
||||
'chat_id' => $obsidianChat->id,
|
||||
'user_id' => $alice->id,
|
||||
'content' => 'Thank you, Test User. Appreciate the honesty.',
|
||||
]);
|
||||
|
||||
// Add Ledgers
|
||||
$kitchenLedger = Ledger::create([
|
||||
'dynamic_id' => $obsidianHousehold->id,
|
||||
'name' => 'Kitchen Chores',
|
||||
'rules' => 'Scores for dishwashing, trash duty, and deep oven cleaning.',
|
||||
'score' => 40,
|
||||
]);
|
||||
|
||||
$coffeeLedger = Ledger::create([
|
||||
'dynamic_id' => $obsidianHousehold->id,
|
||||
'name' => 'Coffee Machine Maintenance',
|
||||
'rules' => ' refill beans and descale monthly.',
|
||||
'score' => 10,
|
||||
]);
|
||||
|
||||
// Seed Chores Mutations
|
||||
Mutation::create([
|
||||
'ledger_id' => $kitchenLedger->id,
|
||||
'user_id' => $testUser->id,
|
||||
'type' => 'reward',
|
||||
'amount' => 25,
|
||||
'description' => 'Emptied and loaded the dishwasher',
|
||||
'status' => 'approved',
|
||||
]);
|
||||
|
||||
Mutation::create([
|
||||
'ledger_id' => $kitchenLedger->id,
|
||||
'user_id' => $testUser->id,
|
||||
'type' => 'reward',
|
||||
'amount' => 15,
|
||||
'description' => 'Took out recycling and trash bags',
|
||||
'status' => 'approved',
|
||||
]);
|
||||
|
||||
// Seed Coffee Mutations
|
||||
Mutation::create([
|
||||
'ledger_id' => $coffeeLedger->id,
|
||||
'user_id' => $testUser->id,
|
||||
'type' => 'reward',
|
||||
'amount' => 10,
|
||||
'description' => 'Descaled and refilled coffee beans',
|
||||
'status' => 'approved',
|
||||
]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user