TappNetwork / filament-authentication-log

32 stars 14 forks source link

Option to pass custom panelName, showing name of Actual user name instead of Class Name #15

Closed abbasmashaddy72 closed 1 month ago

abbasmashaddy72 commented 5 months ago

Usage of this:

FilamentAuthenticationLogPlugin::make()->panelName('admin')

However, this is optional

Why I did this?

$record->authenticatable->name

This will show the name of the Actual username instead of Class Name, which will be good when seeing all the logs at a time.

Below Code to use in Model if you don't have name column:

public function getNameAttribute(): string
{
    return trim($this->first_name . ' ' . $this->last_name);
}

Had N+1 Query Issue when Getting Username, that too fixed by adding Below Query to Resource Table

->modifyQueryUsing(fn (Builder $query) => $query->with('authenticatable'))