| | |
| | | <?php |
| | | namespace App\Controllers; |
| | | |
| | | use App\Models\Contact; |
| | | use Framework\Controller; |
| | | class Home extends Controller { |
| | | public function index() { |
| | | |
| | | echo $this->viewer->render("shared/header.php"); |
| | | |
| | | echo $this->viewer->render("Home/index.php"); |
| | | 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 |
| | | ]); |
| | | } |
| | | |
| | | } |