initial commit
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class BookingResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'uuid' => $this->uuid,
|
||||
'slot_start' => $this->slot_start?->toIso8601String(),
|
||||
'slot_end' => $this->slot_end?->toIso8601String(),
|
||||
'booking_fee' => (float) $this->booking_fee,
|
||||
'reserved_amount' => (float) $this->reserved_amount,
|
||||
'penalty_amount' => (float) $this->penalty_amount,
|
||||
'status' => $this->status,
|
||||
'cancelled_at' => $this->cancelled_at?->toIso8601String(),
|
||||
'penalty_applied_at' => $this->penalty_applied_at?->toIso8601String(),
|
||||
'created_at' => $this->created_at?->toIso8601String(),
|
||||
'machine' => new MachineResource($this->whenLoaded('machine')),
|
||||
'user' => new UserResource($this->whenLoaded('user')),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class EstablishmentResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'uuid' => $this->uuid,
|
||||
'name' => $this->name,
|
||||
'address' => $this->address,
|
||||
'city' => $this->city,
|
||||
'zip_code' => $this->zip_code,
|
||||
'latitude' => $this->latitude !== null ? (float) $this->latitude : null,
|
||||
'longitude' => $this->longitude !== null ? (float) $this->longitude : null,
|
||||
'timezone' => $this->timezone,
|
||||
'is_active' => $this->is_active,
|
||||
'machines' => MachineResource::collection($this->whenLoaded('machines')),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class MachineResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'uuid' => $this->uuid,
|
||||
'name' => $this->name,
|
||||
'type' => $this->type,
|
||||
'status' => $this->status,
|
||||
'qr_code' => $this->qr_code,
|
||||
'cycle_started_at' => $this->cycle_started_at?->toIso8601String(),
|
||||
'cycle_ends_at' => $this->cycle_ends_at?->toIso8601String(),
|
||||
'last_heartbeat_at' => $this->last_heartbeat_at?->toIso8601String(),
|
||||
'establishment' => new EstablishmentResource($this->whenLoaded('establishment')),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class PaymentTransactionResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'uuid' => $this->uuid,
|
||||
'provider' => $this->provider,
|
||||
'provider_payment_id' => $this->provider_payment_id,
|
||||
'amount' => (float) $this->amount,
|
||||
'currency' => $this->currency,
|
||||
'status' => $this->status,
|
||||
'return_url' => $this->return_url,
|
||||
'created_at' => $this->created_at?->toIso8601String(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class PricingRuleResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'establishment_id' => $this->establishment_id,
|
||||
'machine_id' => $this->machine_id,
|
||||
'machine_type' => $this->machine_type,
|
||||
'day_type' => $this->day_type,
|
||||
'slot_start' => $this->slot_start,
|
||||
'slot_end' => $this->slot_end,
|
||||
'price' => (float) $this->price,
|
||||
'label' => $this->label,
|
||||
'requires_app' => $this->requires_app,
|
||||
'priority' => $this->priority,
|
||||
'is_active' => $this->is_active,
|
||||
'establishment' => new EstablishmentResource($this->whenLoaded('establishment')),
|
||||
'machine' => new MachineResource($this->whenLoaded('machine')),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class PromotionResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'establishment_id' => $this->establishment_id,
|
||||
'machine_type' => $this->machine_type,
|
||||
'discount_type' => $this->discount_type,
|
||||
'discount_value' => (float) $this->discount_value,
|
||||
'starts_at' => $this->starts_at?->toIso8601String(),
|
||||
'ends_at' => $this->ends_at?->toIso8601String(),
|
||||
'description' => $this->description,
|
||||
'is_active' => $this->is_active,
|
||||
'establishment' => new EstablishmentResource($this->whenLoaded('establishment')),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class SupervisorResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'uuid' => $this->uuid,
|
||||
'first_name' => $this->first_name,
|
||||
'last_name' => $this->last_name,
|
||||
'email' => $this->email,
|
||||
'role' => $this->role,
|
||||
'is_active' => $this->is_active,
|
||||
'organization_id' => $this->organization_id,
|
||||
'establishment_id' => $this->establishment_id,
|
||||
'last_login_at' => $this->last_login_at?->toIso8601String(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class UserResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'uuid' => $this->uuid,
|
||||
'first_name' => $this->first_name,
|
||||
'last_name' => $this->last_name,
|
||||
'full_name' => $this->full_name,
|
||||
'email' => $this->email,
|
||||
'phone' => $this->phone,
|
||||
'birthdate' => $this->birthdate?->toDateString(),
|
||||
'locale' => $this->locale,
|
||||
'is_active' => $this->is_active,
|
||||
'email_verified_at' => $this->email_verified_at?->toIso8601String(),
|
||||
'created_at' => $this->created_at?->toIso8601String(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class WalletResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'currency' => $this->currency,
|
||||
'current_balance' => (float) $this->current_balance,
|
||||
'status' => $this->status,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class WalletTransactionResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'uuid' => $this->uuid,
|
||||
'type' => $this->type,
|
||||
'amount' => (float) $this->amount,
|
||||
'balance_before' => (float) $this->balance_before,
|
||||
'balance_after' => (float) $this->balance_after,
|
||||
'source_type' => $this->source_type,
|
||||
'source_id' => $this->source_id,
|
||||
'metadata' => $this->metadata,
|
||||
'created_at' => $this->created_at?->toIso8601String(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class WashResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'uuid' => $this->uuid,
|
||||
'trigger_method' => $this->trigger_method,
|
||||
'status' => $this->status,
|
||||
'program' => $this->program,
|
||||
'started_at' => $this->started_at?->toIso8601String(),
|
||||
'ended_at' => $this->ended_at?->toIso8601String(),
|
||||
'duration_minutes' => $this->duration_minutes,
|
||||
'cost' => (float) $this->cost,
|
||||
'created_at' => $this->created_at?->toIso8601String(),
|
||||
'machine' => new MachineResource($this->whenLoaded('machine')),
|
||||
'booking' => new BookingResource($this->whenLoaded('booking')),
|
||||
'user' => new UserResource($this->whenLoaded('user')),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user