Created
July 20, 2015 06:35
-
-
Save devosc/7a5474a7659df7731d0a to your computer and use it in GitHub Desktop.
ViewModel Controller
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 | |
var_dump($request->getRequestUri()); | |
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 | |
/** | |
* | |
*/ | |
return [ | |
'name' => 'home', | |
'route' => '/', | |
'controller' => 'Home\Model', | |
]; |
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 | |
namespace Home; | |
use Mvc5\View\Model\Base; | |
use Mvc5\View\Model\Plugin; | |
use Mvc5\View\Model\ViewModel; | |
use Mvc5\View\ViewPlugin; | |
class Model | |
implements Plugin, ViewModel | |
{ | |
/** | |
* | |
*/ | |
use Base; | |
use ViewPlugin; | |
/** | |
* | |
*/ | |
const TEMPLATE_NAME = 'home'; | |
public function __invoke($request) | |
{ | |
$this->vars(['request' => $request]); | |
return $this; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Elegant.