start project
This commit is contained in:
29
database/factories/BroadcastFactory.php
Normal file
29
database/factories/BroadcastFactory.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Broadcast;
|
||||
use App\Models\Channel;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class BroadcastFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'channel_id' => Channel::factory(),
|
||||
'title' => fake()->sentence(4),
|
||||
'status' => Broadcast::STATUS_PENDING,
|
||||
'recording_enabled' => false,
|
||||
];
|
||||
}
|
||||
|
||||
public function live(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'status' => Broadcast::STATUS_LIVE,
|
||||
'started_at' => now(),
|
||||
'hls_url' => 'http://localhost:8888/demo/index.m3u8',
|
||||
]);
|
||||
}
|
||||
}
|
||||
20
database/factories/CategoryFactory.php
Normal file
20
database/factories/CategoryFactory.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class CategoryFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
$name = fake()->unique()->words(2, true);
|
||||
|
||||
return [
|
||||
'name' => Str::headline($name),
|
||||
'slug' => Str::slug($name),
|
||||
'description' => fake()->optional()->sentence(),
|
||||
];
|
||||
}
|
||||
}
|
||||
26
database/factories/ChannelFactory.php
Normal file
26
database/factories/ChannelFactory.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Category;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ChannelFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
$name = fake()->unique()->words(2, true);
|
||||
|
||||
return [
|
||||
'user_id' => User::factory(),
|
||||
'category_id' => Category::factory(),
|
||||
'slug' => Str::slug($name),
|
||||
'display_name' => Str::headline($name),
|
||||
'description' => fake()->sentence(),
|
||||
'is_live' => false,
|
||||
'viewer_count' => 0,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user