VerificationStatus::class, 'company_id' => 'integer', 'submitted_by' => 'integer', ]; } #[Scope] protected function pending(Builder $query): void { $query->where('status', VerificationStatus::PENDING); } #[Scope] protected function approved(Builder $query): void { $query->where('status', VerificationStatus::APPROVED); } #[Scope] protected function needRevision(Builder $query): void { $query->where('status', VerificationStatus::NEED_REVISION); } #[Scope] protected function rejected(Builder $query): void { $query->where('status', VerificationStatus::REJECTED); } public function company(): BelongsTo { return $this->belongsTo(Company::class); } public function submittedBy(): BelongsTo { return $this->belongsTo(User::class, 'submitted_by'); } public function reviews(): HasMany { return $this->hasMany(VerificationReview::class); } public function latestReview(): HasOne { return $this->hasOne(VerificationReview::class)->latestOfMany(); } }