Skip to content

Instantly share code, notes, and snippets.

@carlosocarvalho
Last active April 20, 2017 04:57
Show Gist options
  • Save carlosocarvalho/4e528fc7ed6bcbba07162673e85133a4 to your computer and use it in GitHub Desktop.
Save carlosocarvalho/4e528fc7ed6bcbba07162673e85133a4 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{{$title}}</title>
</head>
<body>
<table>
<thead>
<tr>
<th>Title</th>
<th>Description</th>
</tr>
</thead>
<tbody>
@foreach ($posts as $row)
<tr>
<td>{{$row['title']}}</td>
<td>{{$row['description']}}</td>
</tr>
@endforeach
</tbody>
</table>
</body>
</html>
{{-- application/views/home.blade.php --}}
<?php
use \App\Core\CoreController;
class Home extends CoreController{
public function __construct(){
parent::__construct();
}
public function index(){
$this->data['title'] = "Codeigniter com Blade";
$this->data['posts'] = [
['id'=>1,'title'=>'Meu titulo 1','description'=>'minha descrição 1 está aqui'],
['id'=>2,'title'=>'Meu titulo 2','description'=>'minha descrição 2 está aqui']
];
//render blade
$this->view('home');
}
}
//** application/controller/Home.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment