mercredi 10 février 2021

Too few arguments laravel

I'm trying to do my own method of registration (in my project only admins can registrate). So i did UserController and registration function:

public function registration(array $data)
    {
        
          if ($data['submit']) {
                  $user=new User;
                  $user->name=$data['name'];
                  $user->surname=$data['surname'];
                  $user->email=$data['email'];
                  $user->password=Hash::make($data['password']);
                  $user->save();
                  
    }

        return view('registration');
    }

but i'm getting error:

Too few arguments to function App\Http\Controllers\UserController::registration(), 0 passed in C:\OpenServer\domains\projecticable\vendor\laravel\framework\src\Illuminate\Routing\Controller.php on line 54 and exactly 1 expected

And it alludes to public function registration(array $data)

There is no problems with view and route(it shows without registration function).



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire