mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-30 18:03:59 +00:00
large commit
This commit is contained in:
@@ -3,16 +3,19 @@
|
||||
namespace App\Classes\General\Abstracts;
|
||||
|
||||
|
||||
use App\Classes\Exceptions\ErrorException;
|
||||
use App\Classes\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\ValueObjects\Constants\Notifications;
|
||||
use App\Classes\ValueObjects\Constants\HttpStatus;
|
||||
use App\Classes\ValueObjects\Response\ApiResponseObject;
|
||||
use ErrorException;
|
||||
use ErrorException as GeneralExceptions;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
abstract class AbstractControllersLogic
|
||||
abstract class AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -49,10 +52,17 @@ abstract class AbstractControllersLogic
|
||||
|
||||
try {
|
||||
|
||||
return $this->logic($request);
|
||||
DB::beginTransaction();
|
||||
|
||||
} catch (ErrorException $exception){
|
||||
return (new ApiResponseObject($this->getNotificationTitle().' failed', $exception->getMessage(), $exception->getCode()))->handler();
|
||||
$response = $this->logic($request);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return $response;
|
||||
|
||||
} catch (ErrorException|GeneralExceptions $exception){
|
||||
return (new ApiResponseObject($this->getNotificationTitle().' failed', $exception->getMessage(),
|
||||
$exception->getCode() ? $exception->getCode() : HttpStatus::SERVER_ERROR))->handler();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user