|
|
@@ -15,7 +15,7 @@ class Bet extends Controller
|
|
|
|
|
|
function index()
|
|
|
{
|
|
|
-// try {
|
|
|
+ try {
|
|
|
$params = request()->validate([
|
|
|
'page' => ['nullable', 'integer', 'min:1'],
|
|
|
'limit' => ['nullable', 'integer', 'min:1'],
|
|
|
@@ -59,11 +59,11 @@ class Bet extends Controller
|
|
|
$item['is_winner'] = $item['profit'] > 0;
|
|
|
}
|
|
|
}
|
|
|
-// } catch (ValidationException $e) {
|
|
|
-// return $this->error(HttpStatus::VALIDATION_FAILED, $e->validator->errors()->first());
|
|
|
-// } catch (Exception $e) {
|
|
|
-// return $this->error(intval($e->getCode()));
|
|
|
-// }
|
|
|
+ } catch (ValidationException $e) {
|
|
|
+ return $this->error(HttpStatus::VALIDATION_FAILED, $e->validator->errors()->first());
|
|
|
+ } catch (Exception $e) {
|
|
|
+ return $this->error(HttpStatus::CUSTOM_ERROR, $e->getMessage());
|
|
|
+ }
|
|
|
return $this->success($result);
|
|
|
}
|
|
|
|