*/ class ProjectFactory extends Factory { /** * The name of the factory's corresponding model. * * @var string */ protected $model = Project::class; /** * Define the model's default state. * * @return array */ public function definition(): array { return [ 'name' => $this->faker->name, 'mail_template' => $this->faker->text, 'mail_subject' => $this->faker->word, 'mail_frequency' => 'Weekly', 'mail_day' => 'Friday', ]; } public function configure() { return $this->afterMaking(function (Project $project) { if (empty($project->download_path)) { $project->download_path = Str::snake(Str::lower($project->name)); } })->afterCreating(function (Project $project) { // Eventuele aanvullende acties na het maken van het model }); } }