added error handler

This commit is contained in:
franknstayn
2022-09-10 19:44:35 +08:00
parent 8cc5dfd71c
commit 0a72981514
4 changed files with 79 additions and 3 deletions

View File

@@ -1,9 +1,13 @@
<?php namespace App\Exceptions;
<?php
namespace App\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
class Handler extends ExceptionHandler {
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that should not be reported.
@@ -34,9 +38,16 @@ class Handler extends ExceptionHandler {
* @param \Exception $e
* @return \Illuminate\Http\Response
*/
// public function render($request, Exception $e)
// {
// return parent::render($request, $e);
// }
public function render($request, Exception $e)
{
if ($e instanceof MethodNotAllowedHttpException) {
abort(404);
}
return parent::render($request, $e);
}
}

View File

@@ -32,6 +32,13 @@ class TeamStoreController extends Controller
$UserModel = new UserModel;
$store_array = $m->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);

View File

@@ -0,0 +1,26 @@
@extends('merchbay_main')
@section('main-content')
<style>
.vh100 {
height: 100vh !important;
}
</style>
<div class="wrapper pb-5">
<div class="main__content">
<div class="container">
<div class="row justify-content-center">
<div class="col col-lg-8 pt-5 text-center text-lg-start">
<h4>404 - Page not found</h4>
<hr class="custom-hr" />
</div>
</div>
<div class="row justify-content-center">
<div class="col col-lg-8 vh100">
<a href="{{ url('/') }}" class="btn btn-black btn-sm px-5">Back to homepage</a>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,27 @@
@extends('merchbay_main')
@section('main-content')
<style>
.vh100 {
height: 100vh !important;
}
</style>
<div class="wrapper pb-5">
<div class="main__content">
<div class="container">
<div class="row justify-content-center">
<div class="col col-lg-8 pt-5 text-center text-lg-start">
<h4>404 - Page not found</h4>
<i>{{ $message }}</i>
<hr class="custom-hr" />
</div>
</div>
<div class="row justify-content-center">
<div class="col col-lg-8 vh100">
<a href="{{ url('/') }}" class="btn btn-black btn-sm px-5">Back to homepage</a>
</div>
</div>
</div>
</div>
</div>
@endsection