*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'amount' => $this->amount, 'status' => $this->status, 'admin_note' => $this->admin_note, 'user' => $this->relationLoaded('user') ? $this->user->only(['id', 'fullname', 'level', 'phone']) : null, 'bank_card' => $this->relationLoaded('bankCard') && $this->bankCard ? $this->bankCard->only(['id', 'card_number', 'holder_name']) : null, 'reviewed_by' => $this->relationLoaded('reviewedBy') && $this->reviewedBy ? $this->reviewedBy->only(['id', 'fullname']) : null, 'created_at' => verta($this->created_at)->format('%Y/%m/%d - H:i'), 'reviewed_at' => $this->reviewed_at ? verta($this->reviewed_at)->format('%Y/%m/%d - H:i') : null, ]; } }