Laravel Array Validation: Set Messages with Position/Index

Laravel Array Validation: Set Messages with Position/Index

Laravel Daily

1 год назад

6,975 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Jales Campos
Jales Campos - 06.09.2023 21:04

:position and ':index doesnt work to me, but :attribute works, can you help me?

Ответить
Rainbow Gravity
Rainbow Gravity - 05.07.2023 23:40

thank you, i've been searching for this

Ответить
muhammad usman
muhammad usman - 29.05.2023 09:19

sir, i want to ask, is it possible to insert many data without looping in nested relationship, for example there is a test, test can have multiple question, and question can have multiple answer

Ответить
Quy Quyền Quý
Quy Quyền Quý - 28.04.2023 05:55

Nice tip. Thanks 👍
But it does not work if attribute is nested array with invokeable rule. Ex:
I have this validation:
'replacements.*' => [
new CardIdValidator([new Action(), new Power()]),
'exists:keywords,id',
'distinct'
]
and this will not work:
public function attributes(): array
{
return [
'replacements.*' => 'replacements #:position',
];
}

Ответить
Hassan Mostafa
Hassan Mostafa - 25.04.2023 00:32

how would you approach something like this scenario you a products array like shown in this video but with an id and qty and you want to have a rule that would take both attributes id,qty to check in db for same available having a custom rule or an inline one would be invoked against the attribute & value it's called on but how do we get access to the whole object here.

Ответить
Birhat Ch-Faiq
Birhat Ch-Faiq - 23.04.2023 22:00

Keep going 😍

Ответить
KicKaSS
KicKaSS - 23.04.2023 21:48

it feels like you are always following the same issues I am having in my project! Thanks for this!

Ответить
Iconic AE
Iconic AE - 23.04.2023 11:20

I have a problem in laravel project in search results page I want to add sort by select input but it's outside the search form so how do I take input from it and apply it to the current variable that is search results without needing to write the same code of search again

Ответить
Sanoop Sahadevan
Sanoop Sahadevan - 23.04.2023 10:12

How can we do this for dynamic row fields?

Ответить
Saber Aldda
Saber Aldda - 23.04.2023 09:49

Thank you

Ответить
sarjamda school
sarjamda school - 23.04.2023 08:08

Hi, I started my career almost 1 year ago as a developer by seeing your feed. I actually like the way you are keeping us up to date with the latest features. But, May I know where I could get that information on my own. Because I found it harder to search on official documentation like these smaller but useful features ?

Ответить