Skip to content

Commit a63482c

Browse files
committed
The version of the php-mvc package has been updated. Small improvements.
1 parent ee8068f commit a63482c

File tree

6 files changed

+20
-4
lines changed

6 files changed

+20
-4
lines changed

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{
2+
}

.vscode/tasks.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
"label": "PHP Server",
88
"type": "shell",
99
"command": "php -S localhost:8000"
10+
},
11+
{
12+
"label": "PHP Server (v5.6.36)",
13+
"type": "shell",
14+
"command": "C:/php/v5.6.36/php.exe -S localhost:8000 -t ${workspaceFolder}"
1015
}
1116
]
1217
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
}
1212
],
1313
"require": {
14-
"php-mvc-project/php-mvc": "^1.1.1",
14+
"php-mvc-project/php-mvc": "^1.2",
1515
"components/jquery": "1.12.4",
1616
"twbs/bootstrap": "3.3.7"
1717
}

controllers/AccountController.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class AccountController extends Controller {
1717

1818
public function __construct() {
1919
// set model type for actions
20-
Model::use(array('index', 'login'), 'Login');
20+
Model::set(array('index', 'login'), 'Login');
2121

2222
// required fields
2323
Model::required('Login', 'username');
@@ -52,6 +52,10 @@ public function index() {
5252
// login action, only for POST requests
5353
// because the $model is required and object
5454
// url: /account/login
55+
56+
/**
57+
* @param \RootNamespaceOfYourApp\Models\Login $model
58+
*/
5559
public function login(\RootNamespaceOfYourApp\Models\Login $model) {
5660
if (!$this->getModelState()->isValid()) {
5761
// model is not valid, return login form

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
// AppBuilder::useCache(new PhpMvc\FileCacheProvider());
4848

4949
// custom handlers
50-
AppBuilder::use(function(PhpMvc\AppContext $appContext) {
50+
AppBuilder::useAppContext(function(PhpMvc\AppContext $appContext) {
5151
/*
5252
// pre-init application handler
5353
$appContext->addPreInit(function(PhpMvc\ActionContext $actionContext) {

views/shared/_layout.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@
5151

5252
<footer>
5353
<div class="container">
54-
Copyright &copy; My Application, <?=date('Y')?>
54+
Copyright &copy; My Application, <?=date('Y')?><br />
55+
<small>
56+
This page is created in <?=round(microtime(true) - PhpMvc\HttpContext::getCurrent()->getRequest()->server('REQUEST_TIME_FLOAT'), 5)?> seconds
57+
<br />
58+
PHP v<?=phpversion()?> &middot; PHP MVC Project v<?=PhpMvc\Info::VERSION?>
59+
</small>
5560
</div>
5661
</footer>
5762
</body>

0 commit comments

Comments
 (0)