Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
noxoua committed Nov 3, 2023
1 parent db9f44a commit a1cea55
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
15 changes: 0 additions & 15 deletions docs/003-get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,6 @@ nav_order: 3

The Logger class is a fundamental component of the "Filament Activity Log" package, responsible for capturing and logging activities related to specific models within your Laravel application. It offers powerful customization options to define precisely which events and data changes should be recorded, making it a flexible and versatile tool for tracking model-related actions.

### Key Features

- **Event Logging**: The Logger class can capture a variety of events related to your models, including record creation, updates, deletions, and restorations. These events are crucial for maintaining an audit trail of activities within your application.

- **Customization**: You can customize each Logger to track only the events and fields that are relevant to your application. This flexibility ensures that you log the data that matters most to your specific use case.

- **Types**: The Logger class supports various field/relation types, making it easy to log and display different types of data appropriately. This includes handling dates, times, media files, boolean values, and more.

- **Relation Support**: If your models have relationships with other models, Logger can track and log these related models as well. This is essential for understanding complex data dependencies.

- **Views**: Logger offers field value views, allowing you to specify how specific fields are displayed in the activity log views. You can use views like "avatar," "image," and "badge" to enhance the user experience.

- **Translated Keys**: For user-friendly activity logs, Logger allows you to map field keys to translated keys, ensuring that your logs are easily understandable in different languages.


### Create a Logger

Use the artisan command to create a logger.
Expand Down
14 changes: 12 additions & 2 deletions docs/005-usage-with-relations.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,21 @@ public static function fields(Fields $fields): Fields
{
return $fields->schema([
'roles' => fn (Field $field) => $field
->relation(),
->relation('name'),

'media' => fn (Field $field) => $field
->relation()
->media(),

'items' => fn (Field $field) => $field
->relation()
->table()
->resolveUsing(function ($model) {
return $model->items->map(fn ($item) => [
'Product' => Product::find($item->shop_product_id)->name,
'Quantity' => $item->qty,
'Unit Price' => $item->unit_price,
])->toArray();
}),
]);
}
```
Expand Down
8 changes: 7 additions & 1 deletion docs/006-resolve-using.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ public static function fields(Fields $fields): Fields
->filter(fn($role) => $role->name !== 'super_secret_admin')
->toArray();
}),

// ->resolveUsing(function ($model) {
// return $model->items->map(fn ($item) => [
// 'Product' => Product::find($item->shop_product_id)->name,
// 'Quantity' => $item->qty,
// 'Unit Price' => $item->unit_price,
// ])->toArray();
// })
]);
}
```
Expand Down

0 comments on commit a1cea55

Please sign in to comment.