*/ class EmployeeSignLogFactory extends Factory { protected $model = EmployeeSignLog::class; /** * Define the model's default state. * * @return array */ public function definition(): array { $employee = Employee::where('store_id', '>', 0)->inRandomOrder()->first(); $type = $this->faker->randomElement(SignType::class); return [ 'store_id' => $employee->store_id, 'employee_id' => $employee->id, 'sign_type' => $type, 'remarks' => $type == SignType::Outside ? '我在外面的' : '', 'position' => ['province' => '重庆', 'city' => '重庆市', 'address' => '重庆市南川区东城街道办事处东环路三号'], 'time' => $this->faker->dateTimeBetween('-7 days', 'now') ]; } }