jwt - Call to undefined method Illuminate\Http\JsonResponse::validate() in Laravel 5.3 -


i implementing registration form using json post request , laravel 5.3 below controller settings

<?php  namespace app\http\controllers\auth;  use app\user; use validator; use illuminate\http\request; use illuminate\http\response; use app\http\controllers\controller; use illuminate\foundation\auth\registersusers;   class registercontroller extends controller {  use registersusers;  public function __construct() {     $this->middleware('guest'); }  protected function validator(array $data) {     $data = $data['register'];     $validator = validator::make($data, [         'email' => 'required|email|max:255|unique:users',         'password' => 'required|min:6|confirmed',     ]);      if($validator->fails())     {         $errors = $validator->errors()->all()[0];         //dd($errors);          return response()->json(['errors'=>$errors]);     }     else     {         return $validator;     } } protected function create(array $data) {      $data = $data['register'];     //dd($data);     user::create([         //'name' => $data['name'],         'email' => $data['email'],         'password' => bcrypt($data['password']),     ]);      return response()->json(['success' => $data['email']], 200); } 

}

but want track server errors in event of multiple registration same email. have handled on client side in need handle on backend too.

the problem validator function keep returning below error

fatalthrowableerror in registersusers.php line 31: call undefined method illuminate\http\jsonresponse::validate()  

i have checked inside framework code , there validate method seems unrecognized json response ideas?


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -