35 lines
979 B
PHP
35 lines
979 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Block;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<Block>
|
|
*/
|
|
class BlockFactory extends Factory
|
|
{
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'publication_id' => \App\Models\Publication::factory(),
|
|
'type' => 'rich_text',
|
|
'content' => ['content' => '<p>' . implode('</p><p>', $this->faker->paragraphs(3)) . '</p>'],
|
|
'order' => 0,
|
|
];
|
|
}
|
|
|
|
public function image(): static
|
|
{
|
|
return $this->state([
|
|
'type' => 'image',
|
|
'content' => [
|
|
'url' => 'https://picsum.photos/1200/630',
|
|
'alt' => $this->faker->sentence(4),
|
|
'caption' => $this->faker->sentence(),
|
|
'style' => $this->faker->randomElement(['full', 'contained', 'float-left', 'float-right']),
|
|
],
|
|
]);
|
|
}
|
|
}
|