Visit::factory(), 'admin_id' => Admin::factory(), 'type' => $this->faker->randomElement([ VisitLog::TYPE_ENTER, VisitLog::TYPE_LEAVE, VisitLog::TYPE_APPROVE, VisitLog::TYPE_REJECT, ]), 'remark' => $this->faker->sentence, ]; } public function enter() { return $this->state(function (array $attributes) { return [ 'type' => VisitLog::TYPE_ENTER, ]; }); } public function leave() { return $this->state(function (array $attributes) { return [ 'type' => VisitLog::TYPE_LEAVE, ]; }); } public function approve() { return $this->state(function (array $attributes) { return [ 'type' => VisitLog::TYPE_APPROVE, ]; }); } public function reject() { return $this->state(function (array $attributes) { return [ 'type' => VisitLog::TYPE_REJECT, ]; }); } }