Skip to content

Instantly share code, notes, and snippets.

@harryWonder
Last active May 15, 2020 00:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harryWonder/4c67ab613c2ca220ff492343633a2016 to your computer and use it in GitHub Desktop.
Save harryWonder/4c67ab613c2ca220ff492343633a2016 to your computer and use it in GitHub Desktop.
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
* @return null|void
* @desc Checks if the user session is set and creates a new instance of the DashboardModel...
**/
public function __construct()
{
if (!isset($_SESSION['auth_status'])) header("Location: index.php");
$this->dashboardModel = new DashboardModel();
}
/**
* @param null|void
* @return array
* @desc Returns an array of news by calling the DashboardModel fetchNews method...
**/
public function getNews() :array
{
return $this->dashboardModel->fetchNews();
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment