*/ class ImportFactory extends Factory { protected $model = Import::class; public function definition(): array { return [ 'type' => fake()->randomElement(['orders', 'mafs', 'reclamations', 'catalog']), 'year' => (int) date('Y'), 'filename' => fake()->uuid() . '.xlsx', 'status' => Import::STATUS_PENDING, 'result' => '', 'user_id' => User::factory(), 'file_path' => null, 'original_filename' => fake()->word() . '.xlsx', ]; } public function pending(): static { return $this->state(fn (array $attributes) => [ 'status' => Import::STATUS_PENDING, ]); } public function completed(): static { return $this->state(fn (array $attributes) => [ 'status' => Import::STATUS_COMPLETED, ]); } public function failed(): static { return $this->state(fn (array $attributes) => [ 'status' => Import::STATUS_FAILED, ]); } public function orders(): static { return $this->state(fn (array $attributes) => [ 'type' => 'orders', ]); } public function mafs(): static { return $this->state(fn (array $attributes) => [ 'type' => 'mafs', ]); } public function reclamations(): static { return $this->state(fn (array $attributes) => [ 'type' => 'reclamations', ]); } }