mardi 21 août 2018

Laravel change logic of Signup

I need to change the logic behind the signup form, so I thought about chaging the function create() of RegisterController file.

So, basically I have this:

class RegisterController extends Controller
{
    /**
     * Create a new user instance after a valid registration.
     *
     * @param  array  $data
     * @return \App\User
     */
    protected function create(array $data)
    {
        $u = User::create(
        [
            'role'      => 'Person',
            'name'      => $data['name'],
            'email'     => $data['email'],
            'password'  => Hash::make($data['password']),
        ]);

        $person = new \App\Models\Persons;
        $person->user_id = $u->id;
        $person->name    = $u->name;
        $person->save();

        return $u;
    }
}

But I'm getting the error:

Class 'App\Models\Persons' not found

The namespace and the name Persons is correct as I use the same code in my personal controllers.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire