Skip to content

Instantly share code, notes, and snippets.

@anthonyterrell
Last active February 13, 2018 16:36
Show Gist options
  • Save anthonyterrell/cd79e74ab3047ccbfdc987631942d177 to your computer and use it in GitHub Desktop.
Save anthonyterrell/cd79e74ab3047ccbfdc987631942d177 to your computer and use it in GitHub Desktop.
Improved Blog post controller, after using model observer.
/**
* Store a newly created resource in storage.
*
* @param \App\Http\Requests\BlogPostRequest $request
* @return \Illuminate\Http\Response
*/
public function store(BlogPostRequest $request)
{
try {
BlogPost::create($request->all());
}catch(Exception $exception) {
// error handling
}
// return response
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment