Skip to content

Instantly share code, notes, and snippets.

View vihugarcia's full-sized avatar

Victor Hugo Garcia vihugarcia

View GitHub Profile
@vihugarcia
vihugarcia / Patient.php
Created July 29, 2023 21:57
Chapter 11 Patient
<?php
namespace App\models;
use SimpleMVC\core\Model as Model;
class Patient extends Model {
public $id;
private $firstname;
private $lastname;
private $birthdate;
@vihugarcia
vihugarcia / EmployeeController.php
Created July 29, 2023 21:55
Chapter 11 EmployeeController
<?php
namespace App\controllers;
use SimpleMVC\core\Controller as Controller;
use App\models\Employee as Employee;
use SimpleMVC\core\View as View;
use SimpleMVC\widgets\DataTable as DataTable;
use SimpleMVC\core\db as db;
class EmployeeController extends Controller {
@vihugarcia
vihugarcia / Employee.php
Created July 29, 2023 21:54
Chapter 11 Employee Model
<?php
namespace App\models;
use SimpleMVC\core\Model as Model;
class Employee extends Model {
public $id;
private $firstname;
private $lastname;
private $type;
@vihugarcia
vihugarcia / UserController.php
Created July 26, 2023 22:44
Chapter 09 UserController.php
<?php
namespace App\controllers;
use SimpleMVC\core\Controller as Controller;
use App\models\User as User;
use SimpleMVC\core\View as View;
use SimpleMVC\core\db as db;
class UserController extends Controller {
private $user;
@vihugarcia
vihugarcia / ClientController.php
Last active July 29, 2023 16:32
Chapter 09 ClientController.php
<?php
namespace App\controllers;
use SimpleMVC\core\Controller as Controller;
use App\models\Client as Client;
use SimpleMVC\core\View as View;
use SimpleMVC\widgets\DataTable as DataTable;
use SimpleMVC\core\db as db;
class ClientController extends Controller {
@vihugarcia
vihugarcia / DependencyResolver.php
Created July 26, 2023 22:41
Chapter 09 DependencyResolver.php
<?php
namespace SimpleMVC\core;
class DependencyResolver {
private static $map = [];
public static function set($key, $value) {
if (!array_key_exists($key, self::$map)) {
self::$map[$key] = $value;
}
@vihugarcia
vihugarcia / Application.php
Created July 26, 2023 22:40
Chapter 09 Application.php
<?php
namespace SimpleMVC\core;
class Application {
public function setReporting()
{
if (DEVELOPMENT_ENVIRONMENT) {
error_reporting(E_ALL);
ini_set('display_error', 'on');
@vihugarcia
vihugarcia / index.php
Created July 26, 2023 22:38
Chapter 09 index.php file
<?php
require "../vendor/autoload.php";
require "../config/config.php";
define('DS', DIRECTORY_SEPARATOR);
define('ROOT', dirname(dirname(__FILE__)));
if (!isset($_GET['url'])) $_GET['url'] = 'site/index';
$url = $_GET['url'];
@vihugarcia
vihugarcia / Application.php
Last active September 3, 2023 13:27
Chapter 9: Application.php
<?php
namespace core;
class Application {
public function setReporting()
{
if (DEVELOPMENT_ENVIRONMENT) {
error_reporting(E_ALL);
ini_set('display_error', 'on');
@vihugarcia
vihugarcia / main.php
Created July 9, 2023 22:20
Chapter 7 main.php
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://code.jquery.com/jquery-3.7.0.min.js" integrity="sha256-2Pmvv0kuTBOenSvLm6bvfBSSHrUJ+3A7x6P5Ebd07/g=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="<?= SITE_BASE ?>css/main.css">
<link rel="stylesheet" href="//cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css">
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<title>SimpleMVC</title>
</head>