UUID user_type and user_id store error #955
-
I use laravel 9 and I'm using UUID in all tables. I didnt found $table->nullableMorphs('owner') on my User migration. Audit migration public function up()
{
$connection = config('audit.drivers.database.connection', config('database.default'));
$table = config('audit.drivers.database.table', 'audits');
Schema::connection($connection)->create($table, function (Blueprint $table) {
$morphPrefix = config('audit.user.morph_prefix', 'user');
$table->bigIncrements('id');
$table->string($morphPrefix . '_type')->nullable();
$table->uuid($morphPrefix . '_id')->nullable();
$table->string('event');
$table->string('auditable_type');
$table->uuid('auditable_id');
$table->text('old_values')->nullable();
$table->text('new_values')->nullable();
$table->text('url')->nullable();
$table->ipAddress('ip_address')->nullable();
$table->string('user_agent', 1023)->nullable();
$table->string('tags')->nullable();
$table->timestamps();
$table->index([$morphPrefix . '_id', $morphPrefix . '_type']);
});
} |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
In the file OwenIt\Auditing\Auditable; I set the variables manually just for testing then noticed that the functions $user->getAuthIdentifier() and $user->getMorphClass() it's not working for me. |
Beta Was this translation helpful? Give feedback.
-
Just wanna make sure, have you use |
Beta Was this translation helpful? Give feedback.
-
User resolver returns |
Beta Was this translation helpful? Give feedback.
laravel-auditing/src/Resolvers/UserResolver.php
Line 28 in f236e42
User resolver returns
auth()->user()
Illuminate/Contracts/Auth/Guard.php#L24-L26
user()
returns Illuminate/Auth/Authenticatable.phpand Illuminate/Auth/Authenticatable.php has
getAuthIdentifier