Open neamtua opened 1 year ago
Please make sure your model is configured for filament,
https://filamentphp.com/docs/2.x/admin/users#configuring-the-name-attribute
I can confirm different guards are not working.
I use the admin_users table and AdminUser Model for filament.
This package is not compatible with multi-guard yet.
I use the admin_users table and AdminUser Model for filament.
This package is not compatible with multi-guard yet.
Could you check activity_log
table on the database and confirm the whether the following columns are empty for the log shown in the screenshot: causer_type
, causer_id
Yes they're empty
On Mon, 10 Jul 2023, 9:01 am ZedoX, @.***> wrote:
I use the admin_users table and AdminUser Model for filament.
This package is not compatible with multi-guard yet. [image: Screenshot 2023-07-10 at 12 24 46 AM] https://user-images.githubusercontent.com/12691366/252164879-10d22646-632d-41f8-bb38-4284ec9453e8.png
Could you check activity_log table on the database and confirm the whether the following columns are empty for the log shown in the screenshot: causer_type, causer_id
— Reply to this email directly, view it on GitHub https://github.com/Z3d0X/filament-logger/issues/61#issuecomment-1628092650, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADA2PJWLY76VUYDKSWNMWHTXPN5A7ANCNFSM6AAAAAAYSOQOUA . You are receiving this because you commented.Message ID: @.***>
I have a similar issue, but in my DB causer_type
and causer_id
are exists.
for example:
causer_type => App\Models\User
causer_id => 1
'Description' and 'Properties' shown in right way with 'First name Last name'
example desc: resourceName Updated by firstName lastName
But User Reference doesn't appear anywhere.
Suggest?
I have a similar issue, but in my DB
causer_type
andcauser_id
are exists.for example:
causer_type => App\Models\User
causer_id => 1
'Description' and 'Properties' shown in right way with 'First name Last name'
example desc: resourceName Updated by firstName lastName
But User Reference doesn't appear anywhere.
Suggest?
Default attribute is causer.name
. So, i assumed your User Table doesn't have name field. in that case, u should add:
// Define an accessor for the 'name' attribute
public function getNameAttribute()
{
return "{$this->firstName} {$this->lastName}";
}
in your User Model.
getNameAttribute()
It work only in description field but nowhere else.
/ActivityResource.php
//...//
TextInput::make('causer_id')
->afterStateHydrated(function ($component, ?Model $record) {
/** @phpstan-ignore-next-line */
**return $component->state($record->causer?->name);**
})
//...//
If fix it in my way. If someone had like I: username and/or first_name, last_name but not have a 'name' column in database: (User not showing in Log Preview)
return $component->state($record->causer?->username); //or last_name etc.
Hardcoded quick-fix :-)
I have two authentication guards. The filament package is using a special admin one that uses a different table and model than the default users configured in laravel. First thing i've noticed is that when i view an event in filament the user field is empty.
Second issue is after logging in with the regular auth guard. This package throws an error because it's trying to call some filament username function that obviously isn't defined on the regular Users model.
Here's a screenshot of the error.
For now, the quickest solution was to disable the access logger from the package config. I can probably override the Logger and try and make it use only the admin guard but that would mean i'd have to override all the guards to properly get the username in all the other logs.
Bottom line, I think the package needs an update to read filament.auth.guard config value and apply that to all the logging.