Files
2025-11-30 11:57:22 +01:00

68 lines
1.3 KiB
PHP

<?php
namespace Paymenter\Extensions\Others\SocialBase\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use App\Models\User;
class MessageReport extends Model
{
protected $table = 'ext_social_message_reports';
protected $fillable = [
'message_id',
'reported_by',
'reason',
'description',
'status',
'reviewed_by',
'reviewed_at',
];
protected $casts = [
'reviewed_at' => 'datetime',
];
/**
* Get the message being reported
*/
public function message(): BelongsTo
{
return $this->belongsTo(Message::class);
}
/**
* Get the user who reported
*/
public function reporter(): BelongsTo
{
return $this->belongsTo(User::class, 'reported_by');
}
/**
* Get the user who reviewed
*/
public function reviewer(): BelongsTo
{
return $this->belongsTo(User::class, 'reviewed_by');
}
/**
* Scope for pending reports
*/
public function scopePending($query)
{
return $query->where('status', 'pending');
}
/**
* Scope for reviewed reports
*/
public function scopeReviewed($query)
{
return $query->where('status', 'reviewed');
}
}