Save workspace changes
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Page;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends Factory<Page>
|
||||
*/
|
||||
final class PageFactory extends Factory
|
||||
{
|
||||
protected $model = Page::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
$title = $this->faker->sentence(4);
|
||||
|
||||
return [
|
||||
'slug' => Str::slug($title) . '-' . $this->faker->unique()->numberBetween(1, 99999),
|
||||
'title' => $title,
|
||||
'body' => '<p>' . implode('</p><p>', $this->faker->paragraphs(2)) . '</p>',
|
||||
'layout' => 'default',
|
||||
'meta_title' => null,
|
||||
'meta_description' => null,
|
||||
'is_published' => true,
|
||||
'published_at' => $this->faker->dateTimeBetween('-1 year', 'now'),
|
||||
];
|
||||
}
|
||||
|
||||
public function draft(): static
|
||||
{
|
||||
return $this->state(['is_published' => false, 'published_at' => null]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user