diff --git a/app/Crud/CouponCrud.php b/app/Crud/CouponCrud.php index 5794db8d7..24ff4a1f3 100755 --- a/app/Crud/CouponCrud.php +++ b/app/Crud/CouponCrud.php @@ -164,6 +164,7 @@ public function getForm( $entry = null ) 'type' => 'text', 'name' => 'code', 'label' => __( 'Coupon Code' ), + 'validation' => 'required', 'description' => __( 'Might be used while printing the coupon.' ), 'value' => $entry->code ?? '', ], [ diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 5810d064f..496708104 100755 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -6,6 +6,7 @@ use Illuminate\Auth\AuthenticationException; use Illuminate\Database\QueryException; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; +use Illuminate\Support\Facades\Log; use Illuminate\Validation\ValidationException as MainValidationException; use Throwable; @@ -77,8 +78,10 @@ public function render($request, Throwable $exception) if ( $exception instanceof QueryException ) { if ( $request->expectsJson() ) { + Log::error( $exception->getMessage() ); + return response()->json([ - 'message' => $exception->getMessage() + 'message' => env( 'APP_DEBUG' ) ? $exception->getMessage() : __( 'A database error has occured.' ) ], 404); }