form.stub 861 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace DummyNamespace;
  3. use Dcat\Admin\Widgets\Form;
  4. use Symfony\Component\HttpFoundation\Response;
  5. class DummyClass extends Form
  6. {
  7. /**
  8. * Handle the form request.
  9. *
  10. * @param array $input
  11. *
  12. * @return Response
  13. */
  14. public function handle(array $input)
  15. {
  16. // dump($input);
  17. // return $this->error('Your error message.');
  18. return $this->success('Processed successfully.', admin_url('/'));
  19. }
  20. /**
  21. * Build a form here.
  22. */
  23. public function form()
  24. {
  25. $this->text('name')->required();
  26. $this->email('email')->rules('email');
  27. }
  28. /**
  29. * The data of the form.
  30. *
  31. * @return array
  32. */
  33. public function default()
  34. {
  35. return [
  36. 'name' => 'John Doe',
  37. 'email' => 'John.Doe@gmail.com',
  38. ];
  39. }
  40. }