コード例 #1
0
 public function index($request)
 {
     $author = new Author('*****@*****.**', '12345678', 'AUTOR_DE_PLATZI');
     $author->setName('Hector', 'Flores');
     $posts = [new Post($author, 'Post #1', 'This is the first post'), new Post($author, 'Post #2', 'This is the second post'), new Post($author, 'Post #3', 'This is the third post'), new Post($author, 'Post #4', 'This is the fourth post')];
     $view = new View('home', ['posts' => $posts]);
     $response = $view->render();
     //echo "<pre>".print_r($request, true)."</pre>";
     //return "Hello at ".
     //$request->getRequestUri().
     //' from Controller';
 }
コード例 #2
0
ファイル: FakeDatabase.php プロジェクト: apalmeras/platziphp
 /**
  * @return Collection
  */
 public function posts()
 {
     $author = new Author('*****@*****.**', '12345678', 'AUTOR_DE_PLATZI');
     $author->setName('Guido', 'Woda');
     return new Collection([1 => new Post($author, 'Post #1', 'This is the first post'), 2 => new Post($author, 'Post #2', 'This is the second post'), 3 => new Post($author, 'Post #3', 'This is the third post'), 4 => new Post($author, 'Post #4', 'This is the fourth post')]);
 }