progetto fatto precedentemente adattato al framework creato con il corso
filippo.bertilotti
2024-06-11 22b1e1c1c5ac7c48bf6cf2b06237a0e180fd550d
commit | author | age
15e03a 1 <?php
F 2 namespace App\Controllers;
7d7d7a 3
3f3e8c 4 use App\Models\Contact;
15e03a 5 use Framework\Controller;
effd6a 6 class Fiat extends Controller {
20a1fc 7     
3f3e8c 8     public function __construct(private Contact $model)
20a1fc 9     {
F 10         
11     }
15e03a 12     public function index() {
effd6a 13         return $this->view("Fiat/index.mvc.php", [
F 14         ]);
15e03a 15     }
20a1fc 16
F 17     public function panda() {
18         return $this->view("Fiat/panda.mvc.php", [
19         ]);
20     }
21
22     public function fiat500() {
23         return $this->view("Fiat/fiat500.mvc.php", [
24         ]);
25     }
26
27     public function tipo() {
28         return $this->view("Fiat/tipo.mvc.php", [
29         ]);
30     }
31
32     public function contact() {
8e493d 33         
7d7d7a 34         if($_SERVER['REQUEST_METHOD'] === 'POST') {
F 35             $data = [
36                 "email" => $this->request->post["email"],
3f3e8c 37                 "telefono" => $this->request->post["telefono"]
7d7d7a 38             ];
3f3e8c 39
7d7d7a 40             $this->model->insert($data);
F 41         }
8e493d 42         $errors = $this->model->getErrors();
7d7d7a 43
20a1fc 44         return $this->view("Fiat/contact.mvc.php", [
8e493d 45             "errors" => $errors
20a1fc 46         ]);
F 47     }
48
15e03a 49 }