Change some first Eloquent methods to firstOrFail

This commit is contained in:
Jonny Barnes 2017-08-09 22:15:45 +01:00
parent e3fff4b9a8
commit 64f541d30d
4 changed files with 6 additions and 5 deletions

View file

@ -29,7 +29,7 @@ class ArticlesController extends Controller
*/
public function show($year, $month, $slug)
{
$article = Article::where('titleurl', $slug)->first();
$article = Article::where('titleurl', $slug)->firstOrFail();
if ($article->updated_at->year != $year || $article->updated_at->month != $month) {
throw new \Exception;
}