ml-archive / nodes-php-backend

Nodes backend package
http://nodesagency.com
MIT License
11 stars 5 forks source link

Allow native Laravel validation #94

Open rtrzebinski opened 7 years ago

rtrzebinski commented 7 years ago

https://laravel.com/docs/5.3/validation#validation-quickstart

Currently we can't use the following syntax in controllers:

$this->validate($request, [
    'title' => 'required|unique:posts|max:255',
    'author.name' => 'required',
    'author.description' => 'required',
]);

Problem is that Laravel uses 'errors' session variable to store validation errors, while Nodes uses 'error'. Because of this Nodes backend views can not see errors. Fix is to change view(s) to use 'errors' instead of 'error'. This is breaking change so major release number should be increased.

Casperhr commented 7 years ago

Maybe we should for now have support for errors and error

And then deprecate error.