-
Notifications
You must be signed in to change notification settings - Fork 0
/
ClientesController.php
79 lines (61 loc) · 1.68 KB
/
ClientesController.php
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
namespace App\Controller;
use App\Controller\AppController;
use Core\Session;
/**
* Description of ClientesController
*
* @author Admin
*/
class ClientesController extends AppController
{
public function __construct(\Core\Request $request, \Core\Session $session, \Core\Auth $auth)
{
parent::__construct($request, $session, $auth);
$this->loadModel('Clientes');
}
//put your code here
public function cadastrar()
{
if ($this->request->isMethod('post'))
{
// debug($this->request->data);
$salvar = $this->Clientes->save($this->request->data);
if ($salvar)
{
$this->request->redirect('/clientes/cadastrar');
} else
{
debug($this->Clientes->validacao_error);
}
exit;
}
}
public function recuperar_senha()
{
}
public function login()
{
if ($this->request->isPost())
{
$this->Auth->setConfig('clientes');
if ($this->Auth->login($this->request->data))
{
$this->redirect('/consumidor/clientes/alterar');
} else
{
$this->session->setFlash('Erro ao Fazer Login', 'danger');
}
}
}
public function logout()
{
$this->session->end();
$this->redirect('/');
}
}