合理的做法应该是,直接返回 404。
Laravel 内置的 findOrFail 可以一行代码实现这个功能。
$item = Product::findOrFail($product_id);
这样,在对不存在的 model 对象进行操作时,就会直接返回 404 页面。
对应的,first 函数,也有 firstOrFail 的实现。
https://www.sunzhongwei.com/findorfail-firstorfail-circumvent-the-search-engine-spiders-crawling-deleted-data-times-wrong?from=content_below_related

