Files
BookStack/database/factories/Activity/Models/CommentFactory.php
Dan Brown 4627dfd4f7 API: Added comment tree to pages-read endpoint
Includes tests to cover
2025-10-24 10:18:52 +01:00

41 lines
909 B
PHP

<?php
namespace Database\Factories\Activity\Models;
use Illuminate\Database\Eloquent\Factories\Factory;
class CommentFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = \BookStack\Activity\Models\Comment::class;
/**
* A static counter to provide a unique local_id for each comment.
*/
protected static int $nextLocalId = 1000;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$text = $this->faker->paragraph(1);
$html = '<p>' . $text . '</p>';
$nextLocalId = static::$nextLocalId++;
return [
'html' => $html,
'parent_id' => null,
'local_id' => $nextLocalId,
'content_ref' => '',
'archived' => false,
];
}
}