Skip to content

Conversation

@ChristopheB
Copy link
Contributor

This PR removes the remaining hardcoded fields id and remember_token in DatabaseUserProvider in order to conform to Authenticatable.

@taylorotwell taylorotwell merged commit 0299be7 into laravel:5.5 Oct 19, 2017
@GrahamCampbell GrahamCampbell changed the title Remove hardcoded fields 'id' and 'remember_token' in DatabaseUserProvider [5.5] Remove hardcoded fields 'id' and 'remember_token' in DatabaseUserProvider Oct 22, 2017
@jfoliveira
Copy link

That's a great improvement!
Unfortunately, it seems it still requires the id column to exists in the user table as it is still hardcoded in Illuminate\Database\Query\Builder on its find method, which is called by DatabaseUserProvider->retrieveById:

    /**
     * Execute a query for a single record by ID.
     *
     * @param  int    $id
     * @param  array  $columns
     * @return mixed|static
     */
    public function find($id, $columns = ['*'])
    {
        return $this->where('id', '=', $id)->first($columns);
    }

I'm trying to use tymondesigns/jwt-auth package in a Lumen project using a database provider, but it doesn't work as my legacy user table doesn't have an id column.
Using Eloquent everything is fine, but that forces me to enable Eloquent facade on Lumen just for that.

Are there any ways to workaround this and set a custom id column when using database provider?

@ChristopheB
Copy link
Contributor Author

@jfoliveira You'd better open a separate issue, or submit a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants