Support the ongoing development of Laravel.io →
posted 6 years ago

Hi! I have an app using Laravel 5.5 and a Firebird 3.0 database. Everything worked well until i needed to extend the app and required the Laravel Passport package for API Auth. When installing the package I got the next error:

SQLSTATE[IM001]: Driver does not support this function: driver does not support lastInsertId()

following the stacktrace I see this method used by the package (in PHP):

public function processInsertGetId(Builder $query, $sql, $values, $sequence = null)

{
    $query->getConnection()->insert($sql, $values);

    $id = $query->getConnection()->getPdo()->lastInsertId($sequence);

    return is_numeric($id) ? (int) $id : $id;
}

it uses lastInsertId() method which is not supported by the driver. For my custom Models of the app i fixed the lastinsertid problem by using a direct query with the generator of the table referred by the model. In this particular case I don't know what is the table used (Laravel Passport package creates many tables for it's own use) so I can't use my custom fix to hardwire the method. I need a way to get last inserted id of the last query executed in the database from php and i'm stuck here. Maybe some of you used Laravel Passport and Firebird together and know how to fix this problem. The laravel driver I'm using is https://github.com/jacquestvanzuydam/laravel-firebird. Apologies for any mispellings.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

lnico lnico Joined 12 Oct 2018

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.