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