dwightwatson / validating

Automatically validating Eloquent models for Laravel
MIT License
968 stars 76 forks source link

[Sugestion] Add Validate Field #212

Closed msyahidin closed 5 years ago

msyahidin commented 5 years ago

Hi @dwightwatson , nice package, almost cover my project needs.

Can you add input field = table field (fillable) as new feature? Or there is it other way to cover it?

This is my function for now

public function hasValidField()
    {
        $newField = array_keys($this->getAttributes());
        $fillableField = array_keys($this->getOriginal());
        // checking update or create new
        if(count($fillableField) < 1)
        {

            $fillableField = $this->getFillable();

        }
        return $fillableField === $newField;
    }

So if there is typo or extra field, it will return false. Thank You

dwightwatson commented 5 years ago

I don't quite understand what this function does.

I suspect this would be better to keep in your own project rather than in this package.