Download the PHP package tapp/filament-auditing without Composer

On this page you can find all versions of the php package tapp/filament-auditing. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package filament-auditing

Filament Laravel Auditing

Latest Version on Packagist Code Style Action Status Total Downloads

A Filament plugin for Laravel Auditing package. This plugin contains a relation manager for audits that you can add to your Filament resources.

This package provides a Filament resource manager that shows a table with all audits on view and edit pages and allows restore audits.

Installation

Note This plugin uses the Laravel Auditing package. First install and configure this package.

You can install the plugin via composer:

Note For Filament 2.x check the 2.x branch

You can publish the view files with:

You can publish the translation files with:

You can publish the config file with:

This is the content of the published config file:

The audits_sort can be used to change the default sort on the audits table.

Usage

To show the audits table in your Filament resource, just add AuditsRelationManager::class on your resource's getRelations method:

That's it, you're all set!

If you access your resource, and edit some data, you will now see the audits table on edit and view pages.

Extending Columns

In case you need to add a column to the AuditsRelationManager that does not already exist in the table, you can add it in the config using the format denoted in the example below, and it will be prepended to the table builder. The name of the column to be added is the key of an associative array that contains other information about the class, as shown in the example below. The class instance of the column must be added, but the methods can be left out if not required, or added wherever necessary.

After adding this information in the config, please run this command for changes to take place.

As things stand, methods with two required parameters are not supported.

Custom View Data Formatting

If you want to modify the content of the audit to display the old and new values in a specific way, such as showing the value of a specific column instead of the ID for relationships, or even customize the entire view to display data in a different way than the default table, you can use one of these methods described below (first, make sure the plugin views are published):

Show a related column instead of foreign id

To use another field to be displayed for relationships instead of the foreign id, in old and new values, you can add on the mapping array, in filament-auditing.php config file, the label and field that should be displayed, as well as the related model, using the foreign key as the array key. For example, on an user relationship with the user_id foreing key, this config will display the user name along with the User label:

And you'd like to customize the view, you can do it in the published view views/vendor/filament-auditing/tables/columns/key-value.blade.php file.

Customizing the Old and New Values

If you need to customize the presentation for other old and new values, besides the related fields, you can add a formatAuditFieldsForPresentation($field, $record) method on the model that is auditable, with two parameters:

This method must return the formatted audit fields.

For example, let's say you have an Article model that is auditable and contains a related user, and you added a formatAuditFieldsForPresentation($field, $record) method that returns the related user name instead of the id, and the data formatted with some HTML code:

Customizing the Entire View Content

If you'd like to customize the entire view content, you may set the custom_audits_view config value to true on config/filament-auditing.php file:

This modification will allow you to take full control of the display and tailor it to your specific requirements. You can now add your custom content on resources/views/vendor/filament-auditing/tables/custom-audit-content.blade.php file. For example:

The owner record is available to this view via $owner variable. To pass some additional parameters to the view, you may use the custom_view_parameters config:

To format a field, you may also add a formatFieldForPresentation method on the owner model, with the field name and value as parameters, like in the example above. This method must return a formatted field.

For example, in an Article model, to return the name of the related user:

An example of the article.php lang file content used in the custom-audit-content.blade.php view code above:

Permissions

Two permissions are registered by default, allowing access to:

You can override these permissions by adding a policy with audit and restoreAudit.

Event emitted

The auditRestored event is emitted when an audit is restored, so you could register a listener using the $listeners property to execute some extra code after the audit is restored.

E.g.: on Edit page of your resource:

Event listener

The audits relation manager listen to the updateAuditsRelationManager event to refresh the audits table.

So you can dispatch this event in the Edit page of your resource (e.g.: in a edit page of a PostResource -> app/Filament/Resources/PostResource/Pages/EditPost.php) when the form is updated:

[!WARNING] When dispaching this event, set the is_lazy configuration to false, on filament-auditing.php config file, to avoid this exception: "Typed property Filament\Resources\RelationManagers\RelationManager::$table must not be accessed before initialization"


All versions of filament-auditing with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
filament/filament Version ^3.0-stable
owen-it/laravel-auditing Version ^13.0
spatie/laravel-package-tools Version ^1.9
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tapp/filament-auditing contains the following files

Loading the files please wait ....