- Updated JournalistResource to conditionally display actions based on user roles and verification status. - Modified ManageJournalists page to hide header actions if verification request status is not NEED_REVISION. - Changed CategoryResource navigation label from 'Kategori Berita' to 'Kategori'. - Adjusted ManageCategories page to reflect the new category label and modal headings. - Refactored Company model to change verificationRequest relationship from MorphOne to HasOne. - Removed verificationRequest method from Journalist and PartnerMedia models. - Updated VerificationRequest model to change verifiable relationship from MorphTo to BelongsTo. - Introduced VerificationService to handle verification logic, including data completeness checks and submission processes. - Created a new migration to adjust the verification_requests table structure. - Enhanced admin verification view to display detailed verification progress and review history. - Updated company and media forms to conditionally show the save button based on verification request status.
47 lines
1.0 KiB
PHP
47 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\VerificationStatus;
|
|
use Illuminate\Database\Eloquent\Attributes\Scope;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class VerificationRequest extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'status' => VerificationStatus::class,
|
|
];
|
|
}
|
|
|
|
#[Scope]
|
|
protected function pending(Builder $query): void
|
|
{
|
|
$query->where('status', VerificationStatus::PENDING);
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|