commit | author | age
|
026ec0
|
1 |
<?php |
c042bc
|
2 |
namespace App\Controllers; |
5cc38b
|
3 |
use App\Models\Product; |
157da9
|
4 |
use Framework\Viewer; |
c54720
|
5 |
class Products { |
ed1f74
|
6 |
public function __construct(private Viewer $viewer, private Product $model) { } |
026ec0
|
7 |
public function index() { |
ed1f74
|
8 |
|
F |
9 |
$products = $this->model->getData(); |
026ec0
|
10 |
|
f76104
|
11 |
echo $this->viewer->render("shared/header.php"); |
F |
12 |
echo $this->viewer->render("Products/index.php", [ |
6a2226
|
13 |
"products"=> $products |
F |
14 |
]); |
026ec0
|
15 |
} |
2e7bc3
|
16 |
|
a93a2f
|
17 |
public function show(string $id) { |
f76104
|
18 |
echo $this->viewer->render("shared/header.php"); |
F |
19 |
echo $this->viewer->render("Products/show.php", [ |
8fdeaa
|
20 |
"id"=> $id |
F |
21 |
]); |
2e7bc3
|
22 |
} |
1f822b
|
23 |
|
F |
24 |
public function showPage(string $title, string $id, string $page) { |
1e5093
|
25 |
echo $title, " ", $id, " ", $page; |
1f822b
|
26 |
} |
026ec0
|
27 |
} |