* @phpcs:disable Generic.Metrics.CyclomaticComplexity.TooHigh */ public function definition() { // @phpcs:enable $button1status = fake()->boolean(75); $button2status = fake()->boolean(75); $publishedStatus = fake()->boolean(75); $publish_at = Carbon::now()->addMonth(); return [ 'title' => fake()->sentence(), 'subtitle' => fake()->sentence(), 'approach_id' => (fake()->boolean(50)) ? collect( Approach::query()->where('published', true)->where('type', ApproachTypeEnum::demarche)->get()->random(1) )->first()->getKey() : null, 'background_alt' => fake()->sentence(), 'background_title' => fake()->sentence(), 'picture_alt' => fake()->sentence(), 'picture_title' => fake()->sentence(), 'button_1_text' => $button1status ? fake()->sentence(3) : null, 'button_1_url' => $button1status ? fake()->url() : null, 'button_2_text' => $button2status ? fake()->sentence(3) : null, 'button_2_url' => $button2status ? fake()->url() : null, 'color_block' => fake()->unique()->safeHexColor(), 'button_1_color_text' => '#FFFFFF', 'button_1_color_background' => '#4E3238', 'button_2_color_text' => '#4E3238', 'button_2_color_background' => '#FFFFFF', 'button_1_status' => $button1status, 'button_1_target' => $button1status ? fake()->boolean(75) : false, 'button_2_status' => $button2status, 'button_2_target' => $button2status ? fake()->boolean(75) : false, 'new' => fake()->boolean(75), 'published' => fake()->boolean(75), 'publish_at' => !$publishedStatus ? $publish_at : null, 'unpublish_at' => !$publishedStatus ? $publish_at->copy()->addDays(rand(10, 20)) : null, ]; } }