$(document).ready(function () {
$("#test-form").validate({
rules: {
projectname:{
required:true,
minlength:5,
remote:{
url: '/checkProject',
type: "post"
}
}
},
messages:{
projectname:{
required: "Please enter at least 5 character project name!",
remote:"This project already exist. Please enter a diffrent name!"
}
}
});
});
here is my web.phpRoute::post('/checkProject','ProjectController@checkProject');
and controllerpublic function checkProject(Request $request){
$RequestedProject = $request->projectname;
$RegisteredProject = Project::all();
$flag = "true";
foreach ($RegisteredProject as $item){
if( $item['name'] == $RequestedProject){
$flag = "false";
break;
}
}
echo $flag;
}
what is the problemvia Mutasim Fuad