According to Laravel's documentation:Inserts
Note: When using PostgreSQL the insertGetId method expects the auto-incrementing column to be named "id".
So, is there a workaround for a custom id
name while using inserGetId
. i.e.
$id = DB::table('users')->insertGetId(
['email' => 'john@example.com', 'votes' => 0]
);