Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. <?php
  2. echo $this->Form->create("POST", ['url' => '/articles/lead']);
  3. echo $this->Form->input('Nome');
  4. echo $this->Form->input('Email');
  5. echo $this->Form->button(__('Salvar'));
  6. echo $this->Form->end();
  7. ?>
  8.  
  9. public function lead(){
  10. $lead = $this->Lead->newEntity();
  11. print_r($lead);
  12. $leads = $this->Lead->newEntity();
  13. if ($this->request->is('post')) {
  14. $article = $this->Lead->patchEntity($leads, $this->request->getData());
  15. if ($this->Lead->save($leads)) {
  16. $this->Flash->success(__('Seu artigo foi salvo.'));
  17. return $this->redirect(['action' => 'index']);
  18. }
  19. $this->Flash->error(__('Não é possível adicionar o seu artigo.'));
  20. }
  21. $this->set('Leads', $leads);
  22. }
  23.  
  24. <?php
  25. // src/Model/Table/LeadTable.php
  26.  
  27. namespace AppModelTable;
  28.  
  29. use CakeORMTable;
  30.  
  31. class LeadTable extends Table
  32. {
  33. public function initialize(array $config)
  34. {
  35. $this->addBehavior('Timestamp');
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement