PromotionStatus::class, 'employee_data' => 'json', ]; public function modelFilter() { return \App\Admin\Filters\EmployeePromotionFilter::class; } public function checkSuccess() { $this->update(['promotion_status' => PromotionStatus::Success]); // 添加职位 $this->employee->jobs()->attach($this->job_id); } public function checkFail() { $this->update(['promotion_status' => PromotionStatus::Fail]); } public function checkCancel() { $this->update(['promotion_status' => PromotionStatus::Employee]); } public function canUpdate(): bool { return in_array($this->promotion_status, [PromotionStatus::Employee, PromotionStatus::Invitor, PromotionStatus::Fail]); } public function store() { return $this->belongsTo(Store::class, 'store_id'); } public function employee() { return $this->belongsTo(Employee::class, 'employee_id'); } public function invitor() { return $this->belongsTo(Employee::class, 'invitor_id'); } public function job() { return $this->belongsTo(Keyword::class, 'job_id', 'key'); } }