mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-22 13:03:16 +00:00
Add AdminProfile resource
This commit is contained in:
parent
71e92261f4
commit
6161cf45aa
1 changed files with 30 additions and 0 deletions
30
app/Http/Resources/AdminProfile.php
Normal file
30
app/Http/Resources/AdminProfile.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use App\Services\AccountService;
|
||||
|
||||
class AdminProfile extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
$res = AccountService::get($this->id, true);
|
||||
$res['domain'] = $this->domain;
|
||||
$res['status'] = $this->status;
|
||||
$res['limits'] = [
|
||||
'exist' => $this->cw || $this->unlisted || $this->no_autolink,
|
||||
'autocw' => (bool) $this->cw,
|
||||
'unlisted' => (bool) $this->unlisted,
|
||||
'no_autolink' => (bool) $this->no_autolink,
|
||||
'banned' => (bool) $this->status == 'banned'
|
||||
];
|
||||
return $res;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue