update api register

This commit is contained in:
Wian Drs
2026-08-01 11:42:42 +07:00
parent b0d08211ec
commit 75342dc7b7
55 changed files with 2254 additions and 35 deletions
@@ -0,0 +1,22 @@
<?php
namespace App\Http\Resources\Notification;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class SystemNotificationCampaignResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id, 'uuid' => $this->uuid, 'tenant_id' => $this->tenant_id,
'title' => $this->title, 'body' => $this->body, 'action_url' => $this->action_url,
'icon' => $this->icon, 'audience' => $this->audience, 'status' => $this->status,
'estimated_recipients' => $this->estimated_recipients,
'processed_recipients' => $this->processed_recipients,
'tenant' => $this->whenLoaded('tenant'), 'creator' => $this->whenLoaded('creator'),
'completed_at' => $this->completed_at, 'created_at' => $this->created_at,
];
}
}
+1
View File
@@ -55,6 +55,7 @@ class UserResource extends JsonResource
'id' => $item->id,
'user_id' => $item->user_id,
'tenant_id' => $item->tenant_id,
'role' => $item->role,
'is_default' => (bool) $item->is_default,
'created_at' => $item->created_at,
'updated_at' => $item->updated_at,
@@ -0,0 +1,21 @@
<?php
namespace App\Http\Resources\Voucher;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class VoucherAgentResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id, 'uuid' => $this->uuid, 'tenant_id' => $this->tenant_id,
'user_id' => $this->user_id, 'user' => $this->whenLoaded('user'), 'agent_code' => $this->agent_code,
'payment_type' => $this->payment_type, 'price_mode' => $this->price_mode,
'discount_percent' => $this->discount_percent, 'commission_percent' => $this->commission_percent,
'credit_limit' => $this->credit_limit, 'outstanding_balance' => $this->outstanding_balance,
'status' => $this->status, 'notes' => $this->notes, 'created_at' => $this->created_at,
];
}
}
@@ -0,0 +1,25 @@
<?php
namespace App\Http\Resources\Voucher;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class VoucherSaleResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id, 'uuid' => $this->uuid, 'sale_number' => $this->sale_number,
'agent' => $this->whenLoaded('agent'), 'package_profile' => $this->whenLoaded('packageProfile'),
'creator' => $this->whenLoaded('creator'), 'quantity' => $this->quantity, 'unit_price' => $this->unit_price,
'discount_amount' => $this->discount_amount, 'total_amount' => $this->total_amount,
'payment_status' => $this->payment_status, 'status' => $this->status, 'created_at' => $this->created_at,
'vouchers' => $this->whenLoaded('vouchers', fn () => $this->vouchers->map(fn ($voucher) => [
'id' => $voucher->id, 'uuid' => $voucher->uuid, 'username' => $voucher->username,
'password' => $voucher->access_password, 'status' => $voucher->status, 'sync_status' => $voucher->sync_status,
'mikrotik' => $voucher->mikrotik, 'valid_until' => $voucher->valid_until,
])),
];
}
}