Implement academy analytics, billing, and web stories updates
This commit is contained in:
67
database/factories/WorldWebStoryFactory.php
Normal file
67
database/factories/WorldWebStoryFactory.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\World;
|
||||
use App\Models\WorldWebStory;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends Factory<WorldWebStory>
|
||||
*/
|
||||
class WorldWebStoryFactory extends Factory
|
||||
{
|
||||
protected $model = WorldWebStory::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
$title = Str::title($this->faker->unique()->words(3, true));
|
||||
$slug = Str::slug($title);
|
||||
|
||||
return [
|
||||
'world_id' => World::factory(),
|
||||
'slug' => $slug,
|
||||
'title' => $title,
|
||||
'subtitle' => $this->faker->sentence(6),
|
||||
'excerpt' => $this->faker->sentence(14),
|
||||
'description' => $this->faker->paragraph(),
|
||||
'seo_title' => $title . ' – Skinbase Web Story',
|
||||
'seo_description' => $this->faker->sentence(18),
|
||||
'poster_portrait_path' => 'web-stories/worlds/' . $slug . '/poster-portrait.webp',
|
||||
'poster_square_path' => 'web-stories/worlds/' . $slug . '/poster-square.webp',
|
||||
'publisher_logo_path' => 'images/skinbase_logo_96.webp',
|
||||
'status' => WorldWebStory::STATUS_DRAFT,
|
||||
'featured' => false,
|
||||
'active' => true,
|
||||
'noindex' => false,
|
||||
'published_at' => null,
|
||||
'starts_at' => null,
|
||||
'ends_at' => null,
|
||||
'created_by' => User::factory(),
|
||||
'updated_by' => User::factory(),
|
||||
];
|
||||
}
|
||||
|
||||
public function published(): self
|
||||
{
|
||||
return $this->state(fn (): array => [
|
||||
'status' => WorldWebStory::STATUS_PUBLISHED,
|
||||
'published_at' => Carbon::now()->subHour(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function visible(): self
|
||||
{
|
||||
return $this->published()->state(fn (): array => [
|
||||
'active' => true,
|
||||
'noindex' => false,
|
||||
'starts_at' => Carbon::now()->subDay(),
|
||||
'ends_at' => Carbon::now()->addDay(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user