mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-16 21:50:53 +08:00
refactor: 规范部分API接口响应格式
This commit is contained in:
28
app/Http/Resources/InviteCodeResource.php
Normal file
28
app/Http/Resources/InviteCodeResource.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class InviteCodeResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
$data = [
|
||||
"user_id" => $this['user_id'],
|
||||
"code" => $this['code'],
|
||||
"pv" => $this['pv'],
|
||||
"status" => $this['status'],
|
||||
"created_at" => $this['created_at'],
|
||||
"updated_at" => $this['updated_at']
|
||||
];
|
||||
if(!config('hidden_features.enable_exposed_user_count_fix')) $data['user_id']= $this['user_id'];
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user