-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathIndexController.php
55 lines (45 loc) · 1.3 KB
/
IndexController.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
<?php
/*
* This file is part of the PHALCON-EXT package.
*
* (c) Jitendra Adhikari <[email protected]>
* <https://github.com/adhocore>
*
* Licensed under MIT license.
*/
use Phalcon\Mvc\Controller;
use PhalconExt\Di\ProvidesDi;
use PhalconExt\Mail\Mailable;
/** MVC controller */
class IndexController extends Controller
{
use Mailable;
use ProvidesDi;
public function indexAction()
{
$this->view->setVars(['engine' => 'Twig', 'mode' => 'MVC']);
}
public function mailAction()
{
$info['newTemplateMail[mailable]=1'] = $this->mail('me@localhost', 'Hi', [
'body' => 'mailable body',
]);
$info['newTemplateMail=2'] = $this->mailer->newTemplateMail('mail.template')
->setTo(['me@localhost', 'test@localhost'])
->setSubject('Hi')
->mail();
$this->view->setVar('info', print_r($info, 1));
}
public function corsAction()
{
return $this->view->setVars(['cors_uri' => 'mvc.php?_url=/corsheader']);
}
public function corsHeaderAction()
{
$response = $this->di('response');
return $response->setJsonContent([
'request' => $this->di('request')->getHeaders(),
'response' => $response->getHeaders()->toArray(),
]);
}
}