Q: How can i reuse Auth's ResigsterController validation rules from another controller without having to grab the whole RegisterController class?
Here are the rules:
...
protected function validator(array $data)
{
return Validator::make($data, [
'fname' => 'required|string|max:255',
'lname' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|confirmed',
'tos' => 'boolean|accepted',
]);
}
...
The other controller in:
app\Http\Controllers\UserController.php
public function update(Request $request, User $user)
{
//I need to validate $request with the rules from
//ControllersAuth\RegisterController.php
}