refactor: remove unused casts and rename announcementMedias relation to announcementMedia for consistency
This commit is contained in:
parent
42691efbfa
commit
d32be18c92
@ -37,7 +37,7 @@ protected function company(Builder $query): void
|
|||||||
$query->where('type', AnnouncementType::COMPANY);
|
$query->where('type', AnnouncementType::COMPANY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function announcementMedias(): HasMany
|
public function announcementMedia(): HasMany
|
||||||
{
|
{
|
||||||
return $this->hasMany(AnnouncementMedia::class);
|
return $this->hasMany(AnnouncementMedia::class);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,14 +13,6 @@ class AnnouncementMedia extends Model
|
|||||||
|
|
||||||
protected $guarded = ['id'];
|
protected $guarded = ['id'];
|
||||||
|
|
||||||
protected function casts(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'announcement_id' => 'integer',
|
|
||||||
'partner_media_id' => 'integer',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function announcement(): BelongsTo
|
public function announcement(): BelongsTo
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Announcement::class);
|
return $this->belongsTo(Announcement::class);
|
||||||
|
|||||||
@ -13,14 +13,6 @@ class CategoryNews extends Model
|
|||||||
|
|
||||||
protected $guarded = ['id'];
|
protected $guarded = ['id'];
|
||||||
|
|
||||||
protected function casts(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'category_id' => 'integer',
|
|
||||||
'news_id' => 'integer',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function category(): BelongsTo
|
public function category(): BelongsTo
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Category::class);
|
return $this->belongsTo(Category::class);
|
||||||
|
|||||||
@ -19,13 +19,6 @@ class Company extends Model implements HasMedia
|
|||||||
|
|
||||||
protected $guarded = ['id'];
|
protected $guarded = ['id'];
|
||||||
|
|
||||||
protected function casts(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'user_id' => 'integer',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function dataChangeEntryLabels(): array
|
public static function dataChangeEntryLabels(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|||||||
@ -26,7 +26,6 @@ protected function casts(): array
|
|||||||
'channel' => Channel::class,
|
'channel' => Channel::class,
|
||||||
'social_media' => SocialMedia::class,
|
'social_media' => SocialMedia::class,
|
||||||
'posting_date' => 'date',
|
'posting_date' => 'date',
|
||||||
'classification_id' => 'integer',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,8 +28,6 @@ protected function casts(): array
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'status' => ApprovalStatus::class,
|
'status' => ApprovalStatus::class,
|
||||||
'cooperation_id' => 'integer',
|
|
||||||
'partner_media_id' => 'integer',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,6 @@ protected function casts(): array
|
|||||||
return [
|
return [
|
||||||
'amount' => 'integer',
|
'amount' => 'integer',
|
||||||
'payment_date' => 'date',
|
'payment_date' => 'date',
|
||||||
'cooperation_media_id' => 'integer',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -25,8 +25,6 @@ protected function casts(): array
|
|||||||
'status' => DataChangeStatus::class,
|
'status' => DataChangeStatus::class,
|
||||||
'old_data' => 'array',
|
'old_data' => 'array',
|
||||||
'new_data' => 'array',
|
'new_data' => 'array',
|
||||||
'user_id' => 'integer',
|
|
||||||
'entity_id' => 'integer',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -18,8 +18,6 @@ protected function casts(): array
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'decision' => DataChangeDecision::class,
|
'decision' => DataChangeDecision::class,
|
||||||
'data_change_request_id' => 'integer',
|
|
||||||
'reviewer_id' => 'integer',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,11 +21,6 @@ protected function casts(): array
|
|||||||
return [
|
return [
|
||||||
'issue' => IssueSentiment::class,
|
'issue' => IssueSentiment::class,
|
||||||
'response' => IssueSentiment::class,
|
'response' => IssueSentiment::class,
|
||||||
'location_id' => 'integer',
|
|
||||||
'sub_location_id' => 'integer',
|
|
||||||
'classification_id' => 'integer',
|
|
||||||
'sub_classification_id' => 'integer',
|
|
||||||
'media_monitoring_id' => 'integer',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,6 +29,11 @@ public function classification(): BelongsTo
|
|||||||
return $this->belongsTo(Classification::class);
|
return $this->belongsTo(Classification::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function departments(): BelongsToMany
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(Department::class, 'department_issue_management');
|
||||||
|
}
|
||||||
|
|
||||||
public function location(): BelongsTo
|
public function location(): BelongsTo
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Location::class);
|
return $this->belongsTo(Location::class);
|
||||||
@ -53,9 +53,4 @@ public function subLocation(): BelongsTo
|
|||||||
{
|
{
|
||||||
return $this->belongsTo(SubLocation::class);
|
return $this->belongsTo(SubLocation::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function departments(): BelongsToMany
|
|
||||||
{
|
|
||||||
return $this->belongsToMany(Department::class, 'department_issue_management');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,7 @@ class Journalist extends Model implements HasMedia
|
|||||||
protected function casts(): array
|
protected function casts(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'partner_media_id' => 'integer',
|
'status' => VerificationStatus::class,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,14 +15,6 @@ class MediaMonitoringTheme extends Model
|
|||||||
|
|
||||||
protected $guarded = ['id'];
|
protected $guarded = ['id'];
|
||||||
|
|
||||||
protected function casts(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'media_monitoring_id' => 'integer',
|
|
||||||
'theme_id' => 'integer',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function mediaMonitoring(): BelongsTo
|
public function mediaMonitoring(): BelongsTo
|
||||||
{
|
{
|
||||||
return $this->belongsTo(MediaMonitoring::class);
|
return $this->belongsTo(MediaMonitoring::class);
|
||||||
|
|||||||
@ -24,8 +24,6 @@ protected function casts(): array
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'status' => ApprovalStatus::class,
|
'status' => ApprovalStatus::class,
|
||||||
'task_assignment_id' => 'integer',
|
|
||||||
'partner_media_id' => 'integer',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,6 @@ class News extends Model implements HasMedia
|
|||||||
protected function casts(): array
|
protected function casts(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'author_id' => 'integer',
|
|
||||||
'published_at' => 'datetime',
|
'published_at' => 'datetime',
|
||||||
'status' => NewsStatus::class,
|
'status' => NewsStatus::class,
|
||||||
'views' => 'integer',
|
'views' => 'integer',
|
||||||
|
|||||||
@ -29,7 +29,6 @@ protected function casts(): array
|
|||||||
return [
|
return [
|
||||||
'type' => MediaType::class,
|
'type' => MediaType::class,
|
||||||
'classification' => MediaClassification::class,
|
'classification' => MediaClassification::class,
|
||||||
'company_id' => 'integer',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +73,7 @@ public static function dataChangeEntryLabels(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function announcementMedias(): HasMany
|
public function announcementMedia(): HasMany
|
||||||
{
|
{
|
||||||
return $this->hasMany(AnnouncementMedia::class);
|
return $this->hasMany(AnnouncementMedia::class);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,13 +13,6 @@ class RejectionReason extends Model
|
|||||||
|
|
||||||
protected $guarded = ['id'];
|
protected $guarded = ['id'];
|
||||||
|
|
||||||
protected function casts(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'rejectable_id' => 'integer',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function rejectable(): MorphTo
|
public function rejectable(): MorphTo
|
||||||
{
|
{
|
||||||
return $this->morphTo();
|
return $this->morphTo();
|
||||||
|
|||||||
@ -25,7 +25,6 @@ protected function casts(): array
|
|||||||
return [
|
return [
|
||||||
'publication_date' => 'date',
|
'publication_date' => 'date',
|
||||||
'status' => ApprovalStatus::class,
|
'status' => ApprovalStatus::class,
|
||||||
'media_task_assignment_id' => 'integer',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,6 @@ protected function casts(): array
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'is_active' => IsActive::class,
|
'is_active' => IsActive::class,
|
||||||
'classification_id' => 'integer',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,6 @@ protected function casts(): array
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'is_active' => IsActive::class,
|
'is_active' => IsActive::class,
|
||||||
'location_id' => 'integer',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,6 @@ protected function casts(): array
|
|||||||
'start_date' => 'date',
|
'start_date' => 'date',
|
||||||
'end_date' => 'date',
|
'end_date' => 'date',
|
||||||
'report_amount' => 'integer',
|
'report_amount' => 'integer',
|
||||||
'cooperation_id' => 'integer',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,8 +23,6 @@ protected function casts(): array
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'status' => VerificationStatus::class,
|
'status' => VerificationStatus::class,
|
||||||
'company_id' => 'integer',
|
|
||||||
'submitted_by' => 'integer',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,9 +55,9 @@ public function company(): BelongsTo
|
|||||||
return $this->belongsTo(Company::class);
|
return $this->belongsTo(Company::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function submittedBy(): BelongsTo
|
public function latestReview(): HasOne
|
||||||
{
|
{
|
||||||
return $this->belongsTo(User::class, 'submitted_by');
|
return $this->hasOne(VerificationReview::class)->latestOfMany();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reviews(): HasMany
|
public function reviews(): HasMany
|
||||||
@ -67,8 +65,8 @@ public function reviews(): HasMany
|
|||||||
return $this->hasMany(VerificationReview::class);
|
return $this->hasMany(VerificationReview::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function latestReview(): HasOne
|
public function submittedBy(): BelongsTo
|
||||||
{
|
{
|
||||||
return $this->hasOne(VerificationReview::class)->latestOfMany();
|
return $this->belongsTo(User::class, 'submitted_by');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,8 +21,6 @@ protected function casts(): array
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'decision' => DecisionAdmin::class,
|
'decision' => DecisionAdmin::class,
|
||||||
'verification_request_id' => 'integer',
|
|
||||||
'reviewer_id' => 'integer',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,8 +10,6 @@ class Visitor extends BaseRouteStatistic
|
|||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
protected $table = 'visitors';
|
|
||||||
|
|
||||||
public function user(): BelongsTo
|
public function user(): BelongsTo
|
||||||
{
|
{
|
||||||
return $this->belongsTo(User::class);
|
return $this->belongsTo(User::class);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user