03.12.2015 Views

laravel4cookbook

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Controller Testing 361<br />

29 );<br />

30<br />

31 $this->dispatcher->listen(<br />

32 "post.store",<br />

33 [$this->mailer, "send"]<br />

34 );<br />

35 }<br />

36<br />

37 public function store()<br />

38 {<br />

39 if ($this->validator->passes("store")) {<br />

40 $this->dispatcher->fire("post.store");<br />

41<br />

42 return $this->response<br />

43 ->route("posts.index")<br />

44 ->with("success", true);<br />

45 }<br />

46<br />

47 return $this->response<br />

48 ->back()<br />

49 ->withErrors($this->validator->messages("store"))<br />

50 ->withInput();<br />

51 }<br />

.<br />

This was extracted from app/controllers/PostController.php.<br />

1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!