You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, i have an issue, in my user model i use UUID and i generate this with a eloquent event, but the package use db insert in users tabla and the problem is that my event is not fire and get this error
SQLSTATE[23502]: Not null violation: 7 ERROR: el valor nulo en la columna «id» de la relación «users» viola la restricción de no nulo DETAIL: La fila que falla contiene (null, test, null, null, null, null, [email protected], null, $2y$12$vW/VaLA7uSMSB3Elh6o.0uWq4JW30pn34XqqceLhcUzRTJbSR.Fka, null, null, null, null, null, null, null, null, null, null, null, null). (Connection: dynamic, SQL: insert into "users" ("name", "email", "password") values (Bellas artes, [email protected], $2y$12$vW/VaLA7uSMSB3Elh6o.0uWq4JW30pn34XqqceLhcUzRTJbSR.Fka))
this is the trait for users
`
namespace App\Traits;
use Illuminate\Database\Eloquent\Model;
use Ramsey\Uuid\Uuid;
trait HasUuid
{
/**
* Boot function to auto-assign a UUID when creating a model.
*/
protected static function bootHasUuid(): void
{
static::creating(function (Model $model) {
if (!$model->getKey()) {
$model->{$model->getKeyName()} = generateUuid();
}
});
}
/**
* Override getIncrementing to false for UUIDs.
*/
public function getIncrementing(): bool
{
return false;
}
/**
* Override getKeyType to string for UUIDs.
*/
public function getKeyType(): string
{
return 'string';
}
}
`
The text was updated successfully, but these errors were encountered:
Hello, i have an issue, in my user model i use UUID and i generate this with a eloquent event, but the package use db insert in users tabla and the problem is that my event is not fire and get this error
SQLSTATE[23502]: Not null violation: 7 ERROR: el valor nulo en la columna «id» de la relación «users» viola la restricción de no nulo DETAIL: La fila que falla contiene (null, test, null, null, null, null, [email protected], null, $2y$12$vW/VaLA7uSMSB3Elh6o.0uWq4JW30pn34XqqceLhcUzRTJbSR.Fka, null, null, null, null, null, null, null, null, null, null, null, null). (Connection: dynamic, SQL: insert into "users" ("name", "email", "password") values (Bellas artes, [email protected], $2y$12$vW/VaLA7uSMSB3Elh6o.0uWq4JW30pn34XqqceLhcUzRTJbSR.Fka))
this is the trait for users
`
namespace App\Traits;
use Illuminate\Database\Eloquent\Model;
use Ramsey\Uuid\Uuid;
trait HasUuid
{
/**
* Boot function to auto-assign a UUID when creating a model.
*/
protected static function bootHasUuid(): void
{
static::creating(function (Model $model) {
if (!$model->getKey()) {
$model->{$model->getKeyName()} = generateUuid();
}
});
}
}
`
The text was updated successfully, but these errors were encountered: