diff --git a/README.md b/README.md index d3ad913..537cba0 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ use Spatie\Activitylog\Models\Activity; class AuthServiceProvider extends ServiceProvider { protected $policies = [ + // Update `Activity::class` with the one defined in `config/activitylog.php` Activity::class => ActivityPolicy::class, ]; //... @@ -53,6 +54,9 @@ class AuthServiceProvider extends ServiceProvider ``` > If you are using [Shield](https://filamentphp.com/plugins/shield) just register the ActivityPolicy generated by it +## Activity Model resolution +The main `Activity` class being used by the Filament Resource instance will be resolved by Spatie's service provider, which loads the model defined by the configuration key found at `activitylog.activity_model` in `config/activitylog.php`. + ## Screenshots ![filament-logger-index](https://user-images.githubusercontent.com/75579178/201537725-47361eb2-aa13-4493-a4d0-af0dde0f4eeb.png) ![filament-logger-detail](https://user-images.githubusercontent.com/75579178/201537729-51b96eed-aa24-42ed-88f6-4683337f7d81.png) diff --git a/resources/lang/it/filament-logger.php b/resources/lang/it/filament-logger.php new file mode 100644 index 0000000..2d0ec17 --- /dev/null +++ b/resources/lang/it/filament-logger.php @@ -0,0 +1,28 @@ + 'Impostazioni', + 'nav.log.label' => 'Registro attività', + 'nav.log.icon' => 'heroicon-o-clipboard-list', + 'resource.label.log' => 'Log', + 'resource.label.logs' => 'Log', + 'resource.label.user' => 'User', + 'resource.label.subject' => 'Soggetto', + 'resource.label.subject_type' => 'Tipo di soggetto', + 'resource.label.description' => 'Descrizione', + 'resource.label.type' => 'Tipologia', + 'resource.label.event' => 'Evento', + 'resource.label.logged_at' => 'Registrato Il', + 'resource.label.properties' => 'Proprietà', + 'resource.label.old' => 'Prima', + 'resource.label.new' => 'Ora', + 'resource.label.old_value' => 'Valore Precedente', + 'resource.label.new_value' => 'Nuovo Valore', +]; diff --git a/src/Resources/ActivityResource.php b/src/Resources/ActivityResource.php index 3bff0e9..19c55ab 100644 --- a/src/Resources/ActivityResource.php +++ b/src/Resources/ActivityResource.php @@ -20,12 +20,12 @@ use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Str; -use Spatie\Activitylog\Models\Activity; +use Spatie\Activitylog\Contracts\Activity; +use Spatie\Activitylog\ActivitylogServiceProvider; use Z3d0X\FilamentLogger\Resources\ActivityResource\Pages; class ActivityResource extends Resource { - protected static ?string $model = Activity::class; protected static ?string $label = 'Activity Log'; protected static ?string $slug = 'activity-logs'; @@ -229,6 +229,11 @@ public static function getPages(): array ]; } + public static function getModel(): string + { + return ActivitylogServiceProvider::determineActivityModel(); + } + protected static function getSubjectTypeList(): array { if (config('filament-logger.resources.enabled', true)) {