mardi 10 novembre 2015

Laravel 5 make a custom register function

Laravel 5 has it's default register function which is in

public function postRegister(Request $request)
{
    $validator = $this->validator($request->all());

    if ($validator->fails()) {
        $this->throwValidationException(
            $request, $validator
        );
    }

    Auth::login($this->create($request->all()));

    return redirect($this->redirectPath());
}

I know that I can copy this code and paste it in my AuthController but there's a change that I need to make which I don't know where to start and find. What I want is change the code for the insertion of data in my users table. I want to change this because I add another column in my users table which is company_name and I have a table which is named companies so basically when the user enter a company_name for registration it will check the companies table if it is existing then return error message if it is. So think there is something like:

$rules = array(
        'company_name' => 'unqiue:companies',

    );

But i don't know where to put this thing in my registration code. Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire