Skip to content
Reece Edwards edited this page Apr 8, 2024 · 2 revisions

Customer.php Documentation

Overview

  • This document provides an overview of the file's structure and functionality.
  • This document provides methods for manipulating customer details.

Table of Contents

Properties

  • Customer.php contains a single property

$database

Methods

  • Customer.php contains a variety of methods used to provide functionality to the website.

Customer Model

__construct()

Constructs the admin model and connects the database.

Parameters

  • $database : PDO

Return N/A

getCustomerByEmail()

Retrieve customer details by email.

*Parameters

  • $email : string
    • The email of the customer.

Return array<string|int, mixed>|null

  • The customer details or null if not found.

getCustomerByUID()

Retrieve customer details by UID.

*Parameters

  • $customerID : int
    • The unique identifier of the customer.

Return array<string|int, mixed>|null

  • The customer details or null if not found.

getCustomerByUsername()

Retrieve customer details by username.

Parameters

  • $username : string
    • The username of the customer.

Return array<string|int, mixed>|null

  • The customer details or null if not found.

registerCustomer()

Register a new user.

Parameters

  • $userData : array<string|int, mixed>
    • The user data including email, username, address, and password hash.

Return array<string|int, mixed>|null

  • The registered customer details or null if registration fails.

updateCustomerDetail()

Update a customer's details.

Parameters

  • $UID : int

    • The unique identifier of the customer.
  • $field : string

    • The field to update.
  • $value : string

    • The new value.

Return bool

  • True if the update is successful, false otherwise.

Customer

__construct()

Customer constructor.

Parameters

  • $customerData : array
    • The customer details.

Return N/A

getUID()

Get the customer's unique identifier.

Parameters N/A

Return int

  • The customer's unique identifier

setUID()

Set the customer's unique identifier.

Parameters

  • $UID : int
    • The customer's unique identifier

Returns N/A

getEmail()

Retrieve the customer's email.

Parameters N/A

Return string

  • The customer's email.

setEmail()

Set the customer's email.

Parameters

  • $email : string
    • The customer's email.

getUsername()

Get the customer's username.

Parameters N/A

Returns string

  • The customer's username.

setUsername()

Set the customer's username.

Parameters

  • $username : string
    • The customer's username.

Returns N/A

getAddress()

Retrieve the customer's address.

Parameters N/A

Return string

  • The customer's address.

setAddress()

Set the customer's address.

Parameters

  • $address : string
    • The customer's address.

Return N/A

getPasswordHash()

Get the customer's password hash.

Parameters N/A

Returns string

  • The customer's password hash.

setPasswordHash()

Set the customer's password hash.

Parameters

  • $passwordHash : string
    • The customer's password hash.

Return N/A

getCreatedAt()

Get the customer's creation date.

Parameters N/A

Returns string

  • The customer's creation date.

getUpdatedAt()

Retrieve the customer's last update date.

Parameters N/A

Return string

  • The customer's last update date.