I am returning the custom error using return back()->withErrors()
approach, exactly like this:
return back()->withErrors([
'A' => 'XXX',
'B' => 'YYY
])
Now, if I can use in my blade, it shows that the errors are returned like so:
ViewErrorBag {#208 ▼
#bags: array:1 [▼
"default" => MessageBag {#209 ▼
#messages: array:2 [▼
"A" => array:1 [▼
0 => "XXX"
]
"B" => array:1 [▼
0 => "YYY"
]
]
#format: ":message"
}
]
}
If I try using , it returns an array, however I don't want to access it through the array.
What I want is to be able to use its key and return the error by the key
What is the proper way of achieving this?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire