Add all files
This commit is contained in:
68
extensions/Others/SocialBase/Models/UserReport.php
Normal file
68
extensions/Others/SocialBase/Models/UserReport.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace Paymenter\Extensions\Others\SocialBase\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use App\Models\User;
|
||||
|
||||
class UserReport extends Model
|
||||
{
|
||||
protected $table = 'ext_social_user_reports';
|
||||
|
||||
protected $fillable = [
|
||||
'reported_user_id',
|
||||
'reported_by',
|
||||
'reason',
|
||||
'description',
|
||||
'status',
|
||||
'admin_notes',
|
||||
'reviewed_by',
|
||||
'reviewed_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'reviewed_at' => 'datetime',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the user being reported
|
||||
*/
|
||||
public function reportedUser(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'reported_user_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user who made the report
|
||||
*/
|
||||
public function reporter(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'reported_by');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user who reviewed the report
|
||||
*/
|
||||
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