feat(cms): sync site assets, revalidate webhook, and document download naming
This commit is contained in:
47
database/factories/PageFactory.php
Normal file
47
database/factories/PageFactory.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Page;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends Factory<Page>
|
||||
*/
|
||||
class PageFactory extends Factory
|
||||
{
|
||||
protected $model = Page::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
$title = $this->faker->sentence(4);
|
||||
$slug = Str::slug($title) ?: 'page-'.Str::random(10);
|
||||
|
||||
return [
|
||||
'title' => $title,
|
||||
'slug' => $slug,
|
||||
'content' => $this->faker->paragraphs(6, true),
|
||||
'template' => null,
|
||||
'custom_fields' => null,
|
||||
'status' => Page::STATUS_PUBLISHED,
|
||||
'meta_description' => $this->faker->optional()->sentence(),
|
||||
'meta_keywords' => null,
|
||||
'parent_id' => null,
|
||||
'sort_order' => 0,
|
||||
'published_at' => now()->subDay(),
|
||||
'created_by_user_id' => User::factory(),
|
||||
'last_updated_by_user_id' => User::factory(),
|
||||
];
|
||||
}
|
||||
|
||||
public function draft(): static
|
||||
{
|
||||
return $this->state(fn () => [
|
||||
'status' => Page::STATUS_DRAFT,
|
||||
'published_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user