cleanup & setting up sync update

This commit is contained in:
2025-03-24 17:19:51 +03:00
parent a2ce9248f0
commit 22473c8f3f
13650 changed files with 507 additions and 1947259 deletions
@@ -1,83 +0,0 @@
<?php
namespace Streamline\Exceptions;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Session\TokenMismatchException;
use Illuminate\Validation\ValidationException;
use Spatie\Permission\Exceptions\UnauthorizedException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Throwable;
class Handler extends ExceptionHandler {
/**
* A list of the exception types that should not be logged in the log file
*
* @var array
*/
protected $dontReport = [
AuthenticationException::class,
AuthorizationException::class,
HttpException::class,
ModelNotFoundException::class,
TokenMismatchException::class,
ValidationException::class,
];
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param Throwable $e
* @return void
* @throws Throwable
*/
public function report(Throwable $e): void
{
parent::report($e);
}
/**
* Render an exception into an HTTP response.
*
* @param Request $request
* @param Throwable $e
* @return Response | RedirectResponse
* @throws Throwable
*/
public function render($request, Throwable $e): Response|RedirectResponse
{
if ($e instanceof UnauthorizedException) {
flash('Access to that page is restricted. Contact system administrator.')->error();
return redirect()->back();
}
return parent::render($request, $e);
}
/**
* Convert an authentication exception into an unauthenticated response.
*
* @param Request $request
* @param AuthenticationException $exception
* @return RedirectResponse | JsonResponse
*/
protected function unauthenticated($request, AuthenticationException $exception): JsonResponse|RedirectResponse
{
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401);
}
return redirect()->guest(url('/'));
}
}