File tree 1 file changed +11
-4
lines changed
1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 5
5
use Carbon \Exceptions \InvalidFormatException ;
6
6
use Illuminate \Support \Carbon ;
7
7
use Illuminate \Support \Facades \Validator ;
8
+ use Illuminate \Validation \ValidationException ;
8
9
use InvalidArgumentException ;
9
10
use Statamic \Facades \GraphQL ;
10
11
use Statamic \Fields \Fieldtype ;
@@ -371,10 +372,16 @@ public function secondsEnabled()
371
372
372
373
public function preProcessValidatable ($ value )
373
374
{
374
- Validator::make (
375
- [$ this ->field ->handle () => $ value ],
376
- [$ this ->field ->handle () => [new ValidationRule ($ this )]],
377
- )->validate ();
375
+ try {
376
+ Validator::make (
377
+ ['field ' => $ value ],
378
+ ['field ' => [new ValidationRule ($ this )]],
379
+ [],
380
+ ['field ' => $ this ->field ->display ()],
381
+ )->validate ();
382
+ } catch (ValidationException $ e ) {
383
+ throw ValidationException::withMessages ([$ this ->field ->fieldPathPrefix () => $ e ->errors ()['field ' ]]);
384
+ }
378
385
379
386
if ($ value === null ) {
380
387
return null ;
You can’t perform that action at this time.
0 commit comments