public function validate()
    {
        // Merge the rules arrays into one array
        $this->mergeRules();

        // Exclude this object from unique checks if object exists
        if ($this->exists)
        {
            $this->excludeFromUniqueChecks();
        }

        $validation = Validator::make($this->attributes, $this->mergedRules, $this->customMessages);

        // Sets the connection, based on the model's connection variable.
        $validation->getPresenceVerifier()->setConnection($this->connection);

        // Set custom messages on validator
        $validation->setAttributeNames($this->niceNames());

        if ($validation->passes())
        {
            $this->valid = true;

            return true;
        }

        $this->validationErrors = $validation->messages();

        return false;
    }
public function validate()
    {
        // Merge the rules arrays into one array
        $this->mergeRules();

        // Exclude this object from unique checks if object exists
        if ($this->exists)
        {
            $this->excludeFromUniqueChecks();
        }

        $validation = Validator::make($this->attributes, $this->mergedRules, $this->customMessages);

        // Sets the connection, based on the model's connection variable.
        $validation->getPresenceVerifier()->setConnection($this->connection);

        // Set custom messages on validator
        $validation->setAttributeNames($this->niceNames());

        if ($validation->passes())
        {
            $this->valid = true;

            return true;
        }

        $this->validationErrors = $validation->messages();

        return false;
    }
public function validate ( ) { // Merge the rules arrays into one array $ this -> mergeRules ( ) ; // Exclude this object from unique checks if object exists if ( $ this -> exists ) { $ this -> excludeFromUniqueChecks ( ) ; } $ validation = Validator :: make ( $ this -> attributes , $ this -> mergedRules , $ this -> customMessages ) ; // Sets the connection, based on the model's connection variable. $ validation -> getPresenceVerifier ( ) -> setConnection ( $ this -> connection ) ; // Set custom messages on validator $ validation -> setAttributeNames ( $ this -> niceNames ( ) ) ; if ( $ validation -> passes ( ) ) { $ this -> valid = true ; return true ; } $ this -> validationErrors = $ validation -> messages ( ) ; return false ; }
Performs validation on the model and return whether it
passed or failed

@return bool
Performs validation on the model and return whether it passed or failed