Change some first Eloquent methods to firstOrFail
This commit is contained in:
parent
e3fff4b9a8
commit
64f541d30d
4 changed files with 6 additions and 5 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue