diff --git a/app/Model/Date.php b/app/Model/Date.php new file mode 100644 index 0000000..2c8a127 --- /dev/null +++ b/app/Model/Date.php @@ -0,0 +1,38 @@ + + * @copyright 2021 nisch.codes + * @license https://projects.nisch.codes/nischcodes/shiftcalc/src/branch/main/LICENSE GPL-3 + * @version 1.0.0 + * @link https://projects.nisch.codes/nischcodes/shiftcalc + */ + +use Nischcodes\Shiftcalc\MVC\BaseModel; + +class HomeModel extends BaseModel { + + // implement the init function + public function init() { + echo "HomeModel init"; + } + + // implement the load function + public function load() { + $this->repository = [ + ['date' => '01/01/2025', 'start' => '', 'end' => '', 'sdec' => 0, 'edec' => 0, 'worktime' => 8, 'break' => 0, 'worktime_total' => 8, 'info' => 'Holiday', 'desc' => 'First Example Holiday'], + ['date' => '03/05/2025', 'start' => '', 'end' => '', 'sdec' => 0, 'edec' => 0, 'worktime' => 8, 'break' => 0, 'worktime_total' => 8, 'info' => 'Holiday', 'desc' => 'Second Example Holiday'] + ]; + } +} \ No newline at end of file diff --git a/app/Model/HomeModel.php b/app/Model/HomeModel.php index 330a15c..e138098 100644 --- a/app/Model/HomeModel.php +++ b/app/Model/HomeModel.php @@ -21,22 +21,18 @@ namespace Nischcodes\Shiftcalc\App\Model; use Nischcodes\Shiftcalc\MVC\BaseModel; -class HomeModel implements BaseModel { - - protected $repository = []; +class HomeModel extends BaseModel { // implement the init function public function init() { echo "HomeModel init"; } - // implement the getAll function - public function getAll() { - return $this->repository; - } - - // implement the get function - public function get($index){ - return $this->repository[$index]; + // implement the load function + public function load() { + $this->repository = [ + ['date' => '01/01/2025', 'start' => '', 'end' => '', 'sdec' => 0, 'edec' => 0, 'worktime' => 8, 'break' => 0, 'worktime_total' => 8, 'info' => 'Holiday', 'desc' => 'First Example Holiday'], + ['date' => '03/05/2025', 'start' => '', 'end' => '', 'sdec' => 0, 'edec' => 0, 'worktime' => 8, 'break' => 0, 'worktime_total' => 8, 'info' => 'Holiday', 'desc' => 'Second Example Holiday'] + ]; } } \ No newline at end of file diff --git a/composer.json b/composer.json index 605b91b..c48d565 100644 --- a/composer.json +++ b/composer.json @@ -15,5 +15,8 @@ "email": "nischcodes@noreply.projects.nisch.codes" } ], - "require": {} + "require": {}, + "scripts": { + "serve": "php -S 127.0.0.1:8000 -t public" + } } diff --git a/src/MVC/BaseController.php b/src/MVC/BaseController.php index eb15d58..03f7102 100644 --- a/src/MVC/BaseController.php +++ b/src/MVC/BaseController.php @@ -17,7 +17,7 @@ namespace Nischcodes\Shiftcalc\MVC; * @link https://projects.nisch.codes/nischcodes/shiftcalc */ -class BaseController { +abstract class BaseController { public function __construct( protected BaseModel $model, diff --git a/src/MVC/BaseModel.php b/src/MVC/BaseModel.php index 4dac8d4..7d854e4 100644 --- a/src/MVC/BaseModel.php +++ b/src/MVC/BaseModel.php @@ -17,8 +17,20 @@ namespace Nischcodes\Shiftcalc\MVC; * @link https://projects.nisch.codes/nischcodes/shiftcalc */ -interface BaseModel { - public function init(); - public function getAll(); - public function get($index); +abstract class BaseModel { + + protected $repository = []; + + abstract public function init(); + abstract public function load(); + + // implement the getAll function + public function getAll() { + return $this->repository; + } + + // implement the get function + public function get($index){ + return $this->repository[$index]; + } } \ No newline at end of file diff --git a/src/MVC/BaseView.php b/src/MVC/BaseView.php index e6ddfdf..f06a3f9 100644 --- a/src/MVC/BaseView.php +++ b/src/MVC/BaseView.php @@ -17,8 +17,8 @@ namespace Nischcodes\Shiftcalc\MVC; * @link https://projects.nisch.codes/nischcodes/shiftcalc */ -interface BaseView { +abstract class BaseView { - public function render($data); + abstract public function render($data); } \ No newline at end of file