Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 15 |
Contact | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 15 |
index | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
create | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 12 |
<?php namespace App\Controllers; | |
use App\Models\Contacts; | |
class Contact extends BaseController | |
{ | |
public function index() | |
{ | |
echo $this->renderPage('contact/index'); | |
} | |
public function create() | |
{ | |
$data = [ | |
'name' => $this->request->getPOST('name', \FILTER_SANITIZE_STRING), | |
'email' => $this->request->getPOST('email', \FILTER_SANITIZE_EMAIL), | |
'message' => $this->request->getPOST('message', \FILTER_SANITIZE_STRING), | |
]; | |
$contacts = new Contacts(); | |
$data['success'] = (bool) $contacts->create($data); | |
$data['errors'] = $contacts->getErrors(); | |
session(); | |
$this->response->redirect(route_url('contact'), $data); | |
} | |
} |