Add all files
This commit is contained in:
67
extensions/Others/SocialBase/Models/MessageReport.php
Normal file
67
extensions/Others/SocialBase/Models/MessageReport.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user