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(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
50
database/factories/WorldWebStoryPageFactory.php
Normal file
50
database/factories/WorldWebStoryPageFactory.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Artwork;
|
||||
use App\Models\WorldWebStory;
|
||||
use App\Models\WorldWebStoryPage;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<WorldWebStoryPage>
|
||||
*/
|
||||
class WorldWebStoryPageFactory extends Factory
|
||||
{
|
||||
protected $model = WorldWebStoryPage::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'story_id' => WorldWebStory::factory(),
|
||||
'artwork_id' => null,
|
||||
'position' => 1,
|
||||
'layout' => WorldWebStoryPage::LAYOUT_ARTWORK,
|
||||
'background_type' => WorldWebStoryPage::BACKGROUND_IMAGE,
|
||||
'background_path' => 'web-stories/worlds/example/pages/page-01.webp',
|
||||
'background_mobile_path' => 'web-stories/worlds/example/pages/page-01.webp',
|
||||
'headline' => 'Story headline',
|
||||
'body' => 'Short supporting copy for this world web story page.',
|
||||
'cta_label' => null,
|
||||
'cta_url' => null,
|
||||
'alt_text' => 'World story background',
|
||||
'caption' => 'Skinbase World',
|
||||
'credit_text' => null,
|
||||
'text_position' => 'bottom',
|
||||
'overlay_strength' => 35,
|
||||
'animation' => 'fade-in',
|
||||
'active' => true,
|
||||
];
|
||||
}
|
||||
|
||||
public function withArtwork(): self
|
||||
{
|
||||
return $this->state(fn (): array => [
|
||||
'artwork_id' => Artwork::factory(),
|
||||
'layout' => WorldWebStoryPage::LAYOUT_ARTWORK,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user