We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When creating a new object, the id is always 0.
id
0
$user = CustomUser::create([ 'email' => '[email protected]', ]); // => ['id' => 0, 'email' => '[email protected]']
Using solution found in issues/12. I've noticed that it throw then a duplicate ID error.
The id field is in auto increment in DB config.
Any clues ?
The text was updated successfully, but these errors were encountered:
For now, I solved using :
public static create(array $attributes = []) { if (!isset($attributes['id'])) { $attributes['id'] = self::all()->last()->id + 1; } return parent::create($attributes); }
Crappy... but working.
Sorry, something went wrong.
For now, I solved using : public static create(array $attributes = []) { if (!isset($attributes['id'])) { $attributes['id'] = self::all()->last()->id + 1; } return parent::create($attributes); } Crappy... but working.
I've the same bug. Coused by wrong table prefix. Use protected $table with prefix and remove all logi from getTable method (it duplicates prefix)
Also put save method to your model to see errors #31 (comment)
And if u fix create u also will fix firstOrCreate etc
No branches or pull requests
When creating a new object, the
id
is always0
.Using solution found in issues/12. I've noticed that it throw then a duplicate ID error.
The id field is in auto increment in DB config.
Any clues ?
The text was updated successfully, but these errors were encountered: