mirror of
https://github.com/brunofontes/shareit.git
synced 2024-11-24 04:14:57 +00:00
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:
parent
4ef87f411d
commit
1350c62f14
@ -62,10 +62,17 @@ class ProductController extends Controller
|
|||||||
* Show a specified Product
|
* Show a specified Product
|
||||||
*
|
*
|
||||||
* @param (int) $id The product id
|
* @param (int) $id The product id
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function show($id)
|
public function show($id)
|
||||||
{
|
{
|
||||||
$product = Product::fromAuthUser()->find($id);
|
$product = Product::fromAuthUser()->find($id);
|
||||||
|
|
||||||
|
if (!$product) {
|
||||||
|
return back();
|
||||||
|
|
||||||
|
}
|
||||||
return view('product.show', compact('product'));
|
return view('product.show', compact('product'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user