mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-09 00:04:50 +00:00
Add AdminModeratedProfileResource.php
This commit is contained in:
parent
06ebb514d7
commit
6fc2dd07d4
1 changed files with 41 additions and 0 deletions
41
app/Http/Resources/Admin/AdminModeratedProfileResource.php
Normal file
41
app/Http/Resources/Admin/AdminModeratedProfileResource.php
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Resources\Admin;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
use App\Profile;
|
||||||
|
|
||||||
|
class AdminModeratedProfileResource extends JsonResource
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Transform the resource into an array.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function toArray(Request $request): array
|
||||||
|
{
|
||||||
|
$profileObj = [];
|
||||||
|
$profile = Profile::withTrashed()->find($this->profile_id);
|
||||||
|
if($profile) {
|
||||||
|
$profileObj = [
|
||||||
|
'username' => $profile->username,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
'id' => $this->id,
|
||||||
|
'domain' => $this->domain,
|
||||||
|
'profile' => $profileObj,
|
||||||
|
'profile_id' => $this->profile_id,
|
||||||
|
'profile_url' => $this->profile_url,
|
||||||
|
'note' => $this->note,
|
||||||
|
'is_banned' => (bool) $this->is_banned,
|
||||||
|
'is_nsfw' => (bool) $this->is_nsfw,
|
||||||
|
'is_unlisted' => (bool) $this->is_unlisted,
|
||||||
|
'is_noautolink' => (bool) $this->is_noautolink,
|
||||||
|
'is_nodms' => (bool) $this->is_nodms,
|
||||||
|
'is_notrending' => (bool) $this->is_notrending,
|
||||||
|
'created_at' => $this->created_at,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue