Protect recordings per user, seed a demo login on container start, and bind-mount the app with Vite HMR for local Compose development.
37 lines
894 B
PHP
Executable File
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]);
|
|
}
|
|
}
|