feat: create PostCategoryFactory for generating post category data feat: create PostFactory for generating post data feat: add retry_requested_at column to services table feat: add vcenter provisioning fields to products table feat: add module_host_id to os table feat: create email_notification_templates table for email templates feat: add scenario and format fields to template table feat: add admin fields to transactions table fix: update ticket table columns and types feat: add uuid to ticket table and backfill existing records fix: make ticket_reply user_id nullable feat: create notifications table for user notifications fix: make ticket uuid nullable feat: create post_categories table for blog categories feat: create posts table for blog posts feat: add invoice email template for PDF generation
38 lines
1.1 KiB
PHP
38 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Post;
|
|
use App\Models\PostCategory;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Str;
|
|
|
|
/**
|
|
* @extends Factory<Post>
|
|
*/
|
|
class PostFactory extends Factory
|
|
{
|
|
protected $model = Post::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
$title = $this->faker->unique()->sentence(6);
|
|
|
|
return [
|
|
'post_category_id' => PostCategory::factory(),
|
|
'title' => $title,
|
|
'slug' => Str::slug($title),
|
|
'excerpt' => $this->faker->sentence(),
|
|
'content' => '<p>' . implode('</p><p>', $this->faker->paragraphs(4)) . '</p>',
|
|
'thumbnail' => null,
|
|
'status' => $this->faker->randomElement(['draft', 'published', 'hidden']),
|
|
'is_featured' => $this->faker->boolean(20),
|
|
'view_count' => $this->faker->numberBetween(0, 3000),
|
|
'reading_time' => $this->faker->numberBetween(2, 12),
|
|
'meta_title' => $title,
|
|
'meta_description' => $this->faker->sentence(),
|
|
'published_at' => now(),
|
|
];
|
|
}
|
|
}
|