Last active
February 13, 2018 16:36
-
-
Save anthonyterrell/cd79e74ab3047ccbfdc987631942d177 to your computer and use it in GitHub Desktop.
Improved Blog post controller, after using model observer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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