*/ class DepartmentFactory extends Factory { protected $model = \App\Containers\InstituteStructure\Models\Department::class; /** * Define the model's default state. * * @return array */ public function definition(): array { $title = $this->faker->sentence; $slug = Str::slug($title); $content = array_map(function () { return [ 'type' => $this->faker->randomElement(['heading', 'paragraph']), 'data' => [ 'id' => $this->faker->numberBetween(1, 1000000), 'content' => $this->faker->paragraph, ], ]; }, range(1, $this->faker->numberBetween(1, 5))); $faculty_id = Faculty::inRandomOrder()->first(); return [ 'title' => $title, 'slug' => $slug, 'content' => $content, 'faculty_id' => $faculty_id, 'created_at' => now(), 'updated_at' => now(), ]; } }