Add Document and DocumentTranslation factories
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Document;
|
||||
use App\Models\DocumentTranslation;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<DocumentTranslation>
|
||||
*/
|
||||
class DocumentTranslationFactory extends Factory
|
||||
{
|
||||
protected $model = DocumentTranslation::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
$title = fake()->sentence(3);
|
||||
$content = fake()->paragraphs(3, true);
|
||||
|
||||
return [
|
||||
'document_id' => Document::factory()->withoutTranslations(),
|
||||
'locale' => 'en',
|
||||
'title' => $title,
|
||||
'content' => $content,
|
||||
'rendered_html' => '<p>' . e($content) . '</p>',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user