From 0a7298151438c8470c85c784451f0837e1061510 Mon Sep 17 00:00:00 2001 From: franknstayn Date: Sat, 10 Sep 2022 19:44:35 +0800 Subject: [PATCH] added error handler --- app/Exceptions/Handler.php | 17 +++++++++--- .../teamstore/TeamStoreController.php | 12 +++++++++ resources/views/errors/404.blade.php | 26 ++++++++++++++++++ resources/views/merchbay/not_found.blade.php | 27 +++++++++++++++++++ 4 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 resources/views/errors/404.blade.php create mode 100644 resources/views/merchbay/not_found.blade.php diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index c7a75d3..957952b 100755 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -1,9 +1,13 @@ -selectTeamStore('StoreUrl', $teamStoreURL); + + if(count($store_array) <= 0) { + return view('merchbay.not_found') + ->with('message', "Store not found"); + } + + // $product_array = $m->selectTeamStoreProducts('TeamStoreId', $store_array[0]->Id); $q = $request->input('q'); @@ -252,6 +259,11 @@ class TeamStoreController extends Controller $store_array = $m->selectTeamStore('StoreUrl', $teamStoreURL); $product_array = $m->selectTeamStoreProducts('ProductURL', $productURL); + if(count($product_array) <= 0) { + return view('merchbay.not_found') + ->with('message', "Store product not found"); + } + $thumbnails_array = $m->getThumbnails($product_array[0]->Id); $teams_array = $m->getTeams($product_array[0]->Id); $selectRoster = $m->selectRoster($product_array[0]->Id); diff --git a/resources/views/errors/404.blade.php b/resources/views/errors/404.blade.php new file mode 100644 index 0000000..565915c --- /dev/null +++ b/resources/views/errors/404.blade.php @@ -0,0 +1,26 @@ +@extends('merchbay_main') + +@section('main-content') + +
+
+
+
+
+

404 - Page not found

+
+
+
+ +
+
+
+@endsection \ No newline at end of file diff --git a/resources/views/merchbay/not_found.blade.php b/resources/views/merchbay/not_found.blade.php new file mode 100644 index 0000000..d76c961 --- /dev/null +++ b/resources/views/merchbay/not_found.blade.php @@ -0,0 +1,27 @@ +@extends('merchbay_main') + +@section('main-content') + +
+
+
+
+
+

404 - Page not found

+ {{ $message }} +
+
+
+ +
+
+
+@endsection \ No newline at end of file