Fixed: error message when opening other user product

The user can only open their own products.
If the user tried to open a product that belongs to
other person, the site were returning an error message.

Now it just go back to the last page.
This commit is contained in:
Bruno F. Fontes 2018-09-19 15:11:30 -03:00
parent 4ef87f411d
commit 1350c62f14

View File

@ -62,10 +62,17 @@ class ProductController extends Controller
* Show a specified Product
*
* @param (int) $id The product id
*
* @return \Illuminate\Http\Response
*/
public function show($id)
{
$product = Product::fromAuthUser()->find($id);
if (!$product) {
return back();
}
return view('product.show', compact('product'));
}
}