diff --git a/addons/default/visiosoft/advs-module/resources/views/list/gallery.twig b/addons/default/visiosoft/advs-module/resources/views/list/gallery.twig
index d2140a2c8..3ec082fff 100644
--- a/addons/default/visiosoft/advs-module/resources/views/list/gallery.twig
+++ b/addons/default/visiosoft/advs-module/resources/views/list/gallery.twig
@@ -17,7 +17,9 @@
{% if setting_value('visiosoft.theme.base::price_fields') %}
- {{ adv.price }} {{ adv.currency }}
+ {{ adv.price != '0'
+ ? adv.price.currency()
+ : trans('visiosoft.module.advs::field.free') }}
{% endif %}
diff --git a/addons/default/visiosoft/advs-module/src/Support/Command/Currency.php b/addons/default/visiosoft/advs-module/src/Support/Command/Currency.php
index afe39ebb2..12dfebc50 100644
--- a/addons/default/visiosoft/advs-module/src/Support/Command/Currency.php
+++ b/addons/default/visiosoft/advs-module/src/Support/Command/Currency.php
@@ -37,6 +37,9 @@ class Currency
$suffix = $this->symbol($currency);
}
+ if (is_object($number)) {
+ $number = $number->getValue();
+ }
$decimal_value = $this->getDecimalValue($number);
diff --git a/app/Exceptions/ExceptionHandler.php b/app/Exceptions/ExceptionHandler.php
index f08304731..a789a8e71 100644
--- a/app/Exceptions/ExceptionHandler.php
+++ b/app/Exceptions/ExceptionHandler.php
@@ -2,13 +2,88 @@
namespace App\Exceptions;
+use Anomaly\Streams\Platform\Exception\ExceptionIdentifier;
use Exception;
+use Illuminate\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler;
+use Illuminate\Http\Request;
+use Illuminate\Http\Response;
+use Illuminate\Support\Facades\Auth;
+use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+use Throwable;
class ExceptionHandler extends Handler
{
+ /**
+ * The exception instance.
+ *
+ * @var Exception
+ */
+ protected $original;
+
+ /**
+ * A list of the exception types that should not be reported.
+ *
+ * @var array
+ */
+ protected $internalDontReport = [
+ \Illuminate\Auth\AuthenticationException::class,
+ \Illuminate\Auth\Access\AuthorizationException::class,
+ \Symfony\Component\HttpKernel\Exception\HttpException::class,
+ \Illuminate\Database\Eloquent\ModelNotFoundException::class,
+ \Illuminate\Session\TokenMismatchException::class,
+ \Illuminate\Validation\ValidationException::class,
+ ];
+
+ protected function prepareException(Exception $e)
+ {
+ $this->original = $e;
+
+ return parent::prepareException($e); // TODO: Change the autogenerated stub
+ }
+
+ public function render($request, Exception $e)
+ {
+ if ($e instanceof AuthenticationException) {
+ return $this->unauthenticated($request, $e);
+ }
+
+ if ($e instanceof NotFoundHttpException && $redirect = config('streams::404.redirect')) {
+ return redirect($redirect);
+ }
+
+ return parent::render($request, $e);
+ }
+
+ protected function renderHttpException(HttpExceptionInterface $e)
+ {
+ if (env('APP_DEBUG') === true) {
+ return $this->convertExceptionToResponse($e);
+ }
+
+ $summary = $e->getMessage();
+ $headers = $e->getHeaders();
+ $code = $e->getStatusCode();
+ $name = trans("streams::error.{$code}.name");
+ $message = trans("streams::error.{$code}.message");
+ $id = $this->container->make(ExceptionIdentifier::class)->identify($this->original);
+
+ if (view()->exists($view = "streams::errors/{$code}")) {
+ return response()->view($view, compact('id', 'code', 'name', 'message', 'summary'), $code, $headers);
+ }
+
+ return response()->view(
+ 'streams::errors/error',
+ compact('id', 'code', 'name', 'message', 'summary'),
+ $code,
+ $headers
+ );
+ }
+
+
public function report(Exception $e)
{
@@ -18,4 +93,33 @@ class ExceptionHandler extends Handler
parent::report($e);
}
+
+ protected function context()
+ {
+ try {
+ return array_filter(
+ [
+ 'user' => Auth::id(),
+ 'email' => Auth::user() ? Auth::user()->email : null,
+ 'url' => request() ? request()->fullUrl() : null,
+ 'identifier' => $this->container->make(ExceptionIdentifier::class)->identify($this->original),
+ ]
+ );
+ } catch (Throwable $e) {
+ return [];
+ }
+ }
+
+ protected function unauthenticated($request, AuthenticationException $exception)
+ {
+ if ($request->expectsJson()) {
+ return response()->json(['error' => 'Unauthenticated.'], 401);
+ }
+
+ if ($request->segment(1) === 'admin') {
+ return redirect()->guest('admin/login');
+ } else {
+ return redirect()->guest('login');
+ }
+ }
}