progetto fatto precedentemente adattato al framework creato con il corso
filippo.bertilotti
2024-06-11 22b1e1c1c5ac7c48bf6cf2b06237a0e180fd550d
src/App/Controllers/fiat.php
@@ -1,9 +1,11 @@
<?php
namespace App\Controllers;
use App\Models\Contact;
use Framework\Controller;
class Fiat extends Controller {
    
    public function __construct()
    public function __construct(private Contact $model)
    {
        
    }
@@ -28,7 +30,19 @@
    }
    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
        ]);
    }