progetto fatto precedentemente adattato al framework creato con il corso
filippo.bertilotti
2024-06-11 3f3e8c04d559f06de9e5452156d18c40919591a7
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() {
7d7d7a 33         if($_SERVER['REQUEST_METHOD'] === 'POST') {
F 34             $data = [
35                 "email" => $this->request->post["email"],
3f3e8c 36                 "telefono" => $this->request->post["telefono"]
7d7d7a 37             ];
3f3e8c 38
7d7d7a 39             $this->model->insert($data);
F 40         }
41         
42
20a1fc 43         return $this->view("Fiat/contact.mvc.php", [
F 44         ]);
45     }
46
15e03a 47 }