Support the ongoing development of Laravel.io →
Configuration Authentication Requests

I am trying to implement an auth driver for authentification over an API to another pre-existing system. For login this works fine, however I am running into issues when trying to implement the ability to register.

I am overriding the Registrar class, what I have found so far is:

create(array $data) must only be called when the system is sure its a valid data set (IE, I can't get the API response [which may tell us that the email is in use] and then redirect away with errors).

As such, I'm trying to implement a validation method which can send the data to the API, which has a validation endpoint. To pass all the data through, I have a function similar to this:

public function validator(array $data)
{
    $data['allData'] = $data;
    return Validator::make($data, [
        'allData' => 'customerAPIValid'
    ]);
}

A little hacky, but it works.

I've also extended the Validation class:

Validator::extend('customerAPIValid', function($attribute, $value, $parameters)
{
    $api = new API();

    $result = $api->validateCustomer($value);

    return isset( $result['error'] );
});

This works fine, but I cannot find a way to pass the validation errors that the API returns, to the view. (The errors are set in $result['error'] which is an array).

Any tips on how I can dynamically, set the error messages into the view?

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

jobbrown jobbrown Joined 20 Jan 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.