I am making a data validation, but it throws this error:
exception 'BadMethodCallException' with message 'Method [validateRequire] does not exist.' in G:\WEB\litraen\vendor\laravel\framework\src\Illuminate\Validation\Validator.php:3265
when performing the validation.
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Validator;
use App\Http\Requests;
class UserController extends Controller
{
public function Register(Request $request){
$validator = Validator::make($request->all(),[
'name' => 'required|max:25',
'email' => 'require|email|unique:users',
'password' => 'require|min:6'
]);
if ($validator->fails()){
return response()->json([
'success' => false,
'errors' => $validator->errors()->toArray()
]);
}
return response()->json([
'success' => true
]);
}
}
why shows this error? that could have wrong?
Thank you :)
SOLUTION:
'name' => 'required|max:25',
'email' => 'required|email|unique:users',
'password' => 'required|min:6'
lacked the "d"
Check the validation "require", change to "required". That should allow it to run.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With