BossBey File Manager
PHP:
8.2.30
OS:
Linux
User:
imagivibe
Root
/
home
/
imagivibe
/
public_html
/
app.imagivibe.com
/
app
/
Concerns
📤 Upload
📝 New File
📁 New Folder
Close
Editing: HasJsonValidationFailedResponse.php
<?php namespace App\Concerns; use Illuminate\Contracts\Validation\Validator; use Illuminate\Http\Exceptions\HttpResponseException; use Illuminate\Http\JsonResponse; trait HasJsonValidationFailedResponse { // Handle a failed validation attempt and return a JSON response. protected function failedValidation(Validator $validator): JsonResponse { $firstError = $validator->errors()->first(); throw new HttpResponseException( response()->json([ 'status' => 'error', 'message' => $firstError, ], JsonResponse::HTTP_UNPROCESSABLE_ENTITY) ); } }
Save
Cancel