migrate to gtea from bistbucket

This commit is contained in:
2026-03-15 17:08:23 +07:00
commit 129ca2260c
3716 changed files with 566316 additions and 0 deletions

View File

@@ -0,0 +1,126 @@
<?php
declare(strict_types=1);
namespace Modules\RestaurantDelivery\Exceptions;
use Exception;
class RiderException extends Exception
{
protected string $errorCode;
public function __construct(
string $message,
string $errorCode = 'RIDER_ERROR',
int $code = 400,
?\Throwable $previous = null
) {
$this->errorCode = $errorCode;
parent::__construct($message, $code, $previous);
}
/**
* Get error code.
*/
public function getErrorCode(): string
{
return $this->errorCode;
}
/**
* Render the exception as JSON response.
*/
public function render(): \Illuminate\Http\JsonResponse
{
return response()->json([
'success' => false,
'message' => $this->getMessage(),
'error_code' => $this->errorCode,
], $this->getCode());
}
/**
* Create exception for rider not found.
*/
public static function notFound(int|string $identifier): self
{
return new self(
"Rider '{$identifier}' not found",
'RIDER_NOT_FOUND',
404
);
}
/**
* Create exception for rider not verified.
*/
public static function notVerified(): self
{
return new self(
'Rider account is not verified',
'RIDER_NOT_VERIFIED',
403
);
}
/**
* Create exception for rider suspended.
*/
public static function suspended(): self
{
return new self(
'Rider account is suspended',
'RIDER_SUSPENDED',
403
);
}
/**
* Create exception for rider not available.
*/
public static function notAvailable(): self
{
return new self(
'Rider is not available to accept orders',
'RIDER_NOT_AVAILABLE',
400
);
}
/**
* Create exception for rider at max capacity.
*/
public static function atMaxCapacity(): self
{
return new self(
'Rider has reached maximum concurrent orders limit',
'RIDER_AT_MAX_CAPACITY',
400
);
}
/**
* Create exception for invalid location.
*/
public static function invalidLocation(): self
{
return new self(
'Invalid rider location data',
'INVALID_RIDER_LOCATION',
400
);
}
/**
* Create exception for rider offline.
*/
public static function offline(): self
{
return new self(
'Rider is currently offline',
'RIDER_OFFLINE',
400
);
}
}