Complete Guide to Form Handling and Validation in Laravel Build a Contact Form with Error Handling

Complete Guide to Form Handling and Validation in Laravel Build a Contact Form with Error Handling

Ajay yadav

1 год назад

5,054 Просмотров

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


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

@rahulmallik4045
@rahulmallik4045 - 03.08.2023 03:05

What if a validation depends "if it has been changed" and "I want to check if it is still unique in the table or not".

Now I do validation in the Controller where I put all the validations in an array. Then add item in it depending on the requirement. Finally do the validation.
Example code bellow:

// Add all the validation here
$validationList = array(
'title' => 'required|max:255',
'category' => 'required',
);

// Add "Unique" to validation if current validation is not equals to the old one.
if($req->postSlug != $getSingle->slug) {
$validationList['slug'] = 'required|unique:blogs,slug|max:255';
} else {
$validationList['slug'] = 'required|max:255';
}

// Do validation depending on the array "$validationList"
$req->validate($validationList);

Ответить
@akhileshkumar-iu9uq
@akhileshkumar-iu9uq - 15.07.2023 05:01

I need to check in my login controller whether my current token is expired or not, I'm using sanctum

Ответить
@saisaladi5151
@saisaladi5151 - 05.07.2023 06:46

I have lot of routing issues plz make a video on routing from basic to advanced sir

Ответить
@programmingevolution1464
@programmingevolution1464 - 30.06.2023 15:47

Sir please create series on large projects like CRM & Microservices

Ответить
@rahulmaurya85
@rahulmaurya85 - 30.06.2023 10:14

useful video

Ответить