mirror of
https://github.com/Deathgarden-Rebirth/Deathgarden_Rebirth-Rewrite.git
synced 2026-09-08 11:15:09 -05:00
54 lines
1.2 KiB
PHP
54 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Game\Moderation;
|
|
|
|
use App\Http\Requests\Api\Moderation\ReportPlayerInfoListEntry;
|
|
use App\Models\User\User;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Support\Collection;
|
|
|
|
/**
|
|
* @mixin IdeHelperPlayerReport
|
|
*/
|
|
class PlayerReport extends Model
|
|
{
|
|
protected $casts = [
|
|
'player_infos' => 'array',
|
|
];
|
|
|
|
protected $attributes = [
|
|
'handled' => false,
|
|
|
|
];
|
|
|
|
public function reportedUser(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'reported_user_id');
|
|
}
|
|
|
|
public function reportingUser(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'reporting_user_id');
|
|
}
|
|
|
|
public function handledBy(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'handled_by_id');
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @return Collection|ReportPlayerInfoListEntry[]
|
|
* */
|
|
public function playerInfos(): Collection {
|
|
$collection = collect();
|
|
|
|
foreach ($this->player_infos as $playerInfo) {
|
|
$collection->add(ReportPlayerInfoListEntry::makeFromArray($playerInfo));
|
|
}
|
|
|
|
return $collection;
|
|
}
|
|
}
|