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

Admin.php Documentation

Overview

  • This document provides an overview of the file's structure and functionality.
  • Admin.php handles various functionality relating to managing administrator details.

Table of Contents

Properties

  • Admin.php contains a single property

$database

Methods

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

Admin Model

__construct()

Constructs the admin model and connects the database.

Parameters

  • $database : PDO

Return N/A

addAdmin()

Adds a new admin to the database

Parameters

  • $adminData : array<string|int, mixed>
    • The admin details to add inluding username and password.

Return array<string|int, mixed>|null

  • The registered admin details or null if registration fails.

getAdminByUID()

Retrieve admin details by UID.

Parameters

  • $adminID : int
    • The unique identifier of the admin.

Return array<string|int, mixed>|null

  • The admin details or null if not found.

getAdminByUsername()

Retrieve admin details by username.

Parameters

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

Return array<string|int, mixed>|null

  • The admin details or null if not found.

updateAdmin()

Update an admin's details.

Parameters

  • $adminID : int

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

    • The field to update.
  • $value : string

    • The new value.

Return bool

  • True if the update was successful, false otherwise.

Admin

__construct()

Admin constructor.

Parameters

  • $adminData : array
    • The admin details.

Return N/A

getUID()

Get the admin's unique identifier.

Parameters N/A

Return int

  • The admin's unique identifier.

setUID()

Set the admin's unique identifier.

Parameters

  • $adminID : int
    • The admin's unique identifier

Returns N/A

getUsername()

Get the admin's username.

Parameters N/A

Returns string

  • The admin's username.

setUsername()

Set the admin's username.

Parameters

  • $username : string
    • The admin username.

Returns N/A

getPasswordHash()

Get the admin's password hash.

Parameters N/A

Returns string

  • The admin's password hash.

setPasswordHash()

Set the admin's password hash.

Parameters

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

Return N/A

getCreatedAt()

Get the admin's creation date.

Parameters N/A

Returns string

  • The admin's creation date.

setCreatedAt()

Set the admin's creation date.

Parameters

  • $createdAt : string
    • The admin's creation date.

getUpdatedAt()

Get the admin's last update date.

Parameters N/A

Return string

  • The admin's last update date.

Clone this wiki locally