Last active
May 15, 2020 00:22
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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