lundi 27 février 2017

Internal server error in laravel 5.3

I am trying to validate a form data if it exist in database. I'm using jquery validate plugin.But I am getting the internal server error 500. Here is my validation.js file

$(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.php

Route::post('/checkProject','ProjectController@checkProject');

and controller

public function checkProject(Request $request){
        $RequestedProject = "Project Y";
        $RegisteredProject = Project::all();
        $flag = "true";
        foreach ($RegisteredProject as $item){
           if( $item['name'] == $RequestedProject){
               $flag = "false";
               break;
           }
        }
        echo $flag;
    }

what is the problem



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2mv6TK1
via IFTTT

Aucun commentaire:

Enregistrer un commentaire