Skip to content

Instantly share code, notes, and snippets.

View harryWonder's full-sized avatar
🇳🇬
I am that software developer that you cannot sideline. I am <harrywonder/>

Ilori stephen harryWonder

🇳🇬
I am that software developer that you cannot sideline. I am <harrywonder/>
View GitHub Profile
@harryWonder
harryWonder / Db.php
Last active May 15, 2020 00:15
A Db Class which provides a decent abstraction layer for making database operations.
<?php
class Db {
protected $dbName = 'learning_dollars_db'; /** Database Name */
protected $dbHost = 'localhost'; /** Database Host */
protected $dbUser = 'root'; /** Database Root */
protected $dbPass = ''; /** Databse Password */
protected $dbHandler, $dbStmt;
/**
* @param null|void
@harryWonder
harryWonder / Db.php
Last active May 15, 2020 00:15
A Db Class which provides a decent abstraction layer for making database operations.
<?php
class Db {
protected $dbName = 'learning_dollars_db'; /** Database Name */
protected $dbHost = 'localhost'; /** Database Host */
protected $dbUser = 'root'; /** Database Root */
protected $dbPass = ''; /** Databse Password */
protected $dbHandler, $dbStmt;
/**
* @param null|void
@harryWonder
harryWonder / LoginModel.php
Last active May 15, 2020 00:16
A LoginModel class which searches for a user based on the user email address and returns an array with a status and data key which determines the result of the search
<?php
require_once(__dir__ . '/Db.php');
class LoginModel extends Db {
/**
* @param string
* @return array
* @desc Returns a user record based on the method parameter....
**/
public function fetchEmail(string $email) :array
@harryWonder
harryWonder / RegisterModel.php
Last active May 15, 2020 00:17
This file extends the Db.php Class and provides two methods for creating a new user and fetching a new user.
<?php
require_once(__dir__ . '/Db.php');
class RegisterModel extends Db {
/**
* @param array
* @return array
* @desc Creates and returns a user record....
**/
public function createUser(array $user) :array
@harryWonder
harryWonder / DashboardModel.php
Last active May 15, 2020 00:11
This file extends the Db Class and houses a method which is responsible for fetching a list of news from the database.
<?php
require_once(__dir__ . '/Db.php');
class DashboardModel extends Db {
/**
* @param null
* @return array
* @desc Returns an array of news....
**/
public function fetchNews() :array
@harryWonder
harryWonder / Controller.php
Created May 10, 2020 08:51
This file acts as the base controller for other controllers in the controllers folder.
<?php
session_start();
class Controller { }
?>
@harryWonder
harryWonder / Dashboard.php
Last active May 15, 2020 00:22
This file houses a class which loads in some dependencies from the DashboardModel.php file.
<?php
require_once(__dir__ . '/Controller.php');
require_once('./Model/DashboardModel.php');
class Dashboard extends Controller {
public $active = 'dashboard'; //for highlighting the active link...
private $dashboardModel;
/**
* @param null|void
@harryWonder
harryWonder / Login.php
Last active May 15, 2020 07:04
This file loads in the LoginModel Controller and it also extends the base controller.
<?php
require_once(__dir__ . '/Controller.php');
require_once('./Model/LoginModel.php');
class Login extends Controller {
public $active = 'login'; //for highlighting the active link...
private $loginModel;
/**
@harryWonder
harryWonder / Register.php
Last active May 15, 2020 07:05
This class extends the base controller and loads in the RegisterModel as a dependency
<?php
require_once(__dir__ . '/Controller.php');
require_once('./Model/RegisterModel.php');
class Register extends Controller {
public $active = 'Register'; //for highlighting the active link...
private $registerModel;
/**
* @param null|void
@harryWonder
harryWonder / Logout.php
Last active May 15, 2020 07:06
This file houses a logout class which extends the base controller. This class destroys the application session and performs an http redirect.
<?php
require_once(__dir__ . '/Controller.php');
class Logout extends Controller {
/**
* @param null|void
* @return null|void
* @desc Destroys the application session and redirects to the login page...
**/