Комментарии:
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);
I need to check in my login controller whether my current token is expired or not, I'm using sanctum
ОтветитьI have lot of routing issues plz make a video on routing from basic to advanced sir
ОтветитьSir please create series on large projects like CRM & Microservices
Ответитьuseful video
Ответить