Files
AndyTranscribe/database/seeders/DatabaseSeeder.php
T
ben bfcfc12f58 Add Fortify auth, Flux dark mode, demo seed, and Docker hot reload.
Protect recordings per user, seed a demo login on container start, and bind-mount the app with Vite HMR for local Compose development.
2026-08-12 18:38:53 +02:00

37 lines
894 B
PHP
Executable File

<?php
namespace Database\Seeders;
use App\Models\Recording;
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
{
$email = (string) env('SEED_USER_EMAIL', 'demo@example.com');
$name = (string) env('SEED_USER_NAME', 'Demo User');
$password = (string) env('SEED_USER_PASSWORD', 'password');
$user = User::query()->updateOrCreate(
['email' => $email],
[
'name' => $name,
'password' => $password,
'email_verified_at' => now(),
],
);
Recording::query()
->whereNull('user_id')
->update(['user_id' => $user->id]);
}
}