Update AdminReport

This commit is contained in:
Daniel Supernault 2024-10-18 02:43:49 -06:00
parent 80ee8a7414
commit c4b5148b17
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1

View file

@ -2,10 +2,11 @@
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
use App\Services\AccountService;
use App\Services\StatusService;
use App\Story;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class AdminReport extends JsonResource
{
@ -29,10 +30,17 @@ class AdminReport extends JsonResource
'created_at' => $this->created_at,
];
if($this->object_id && $this->object_type === 'App\Status') {
if ($this->object_id && $this->object_type === 'App\Status') {
$res['status'] = StatusService::get($this->object_id, false);
}
if ($this->object_id && $this->object_type === 'App\Story') {
$story = Story::find($this->object_id);
if ($story) {
$res['story'] = $story->toAdminEntity();
}
}
return $res;
}
}