Commit 8fe2e5d0 by Francisco Salazar

redireccion por si 404

parent f7be49f7
......@@ -36,19 +36,17 @@ class ProductController extends Controller
{
$product = Product::where('slug',$slug)->first();
$otros = $product->category->products()->where('active', true)->where("id", "<>", $product->id)->inRandomOrder()->take(config("product.product-show.otros"))->get();
$categories = Category::all();
if ($product != null) {
if (!$product->active) {
return redirect('inactivo');
return redirect()->route("main.product")->with('inactivo', 'No esta disponible');
}
} else {
return redirect('no_existe');
return redirect()->route("main.product")->with('notFound', 'No existe');
}
$otros = $product->category->products()->where('active', true)->where("id", "<>", $product->id)->inRandomOrder()->take(config("product.product-show.otros"))->get();
return view('product-public::single')
->with('product', $product)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment