limanweb/eloquent-logger

Extensions for Laravel Eloquent\Model logging

Installs: 3 473

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:package

v1.0.4 2021-03-05 10:32 UTC

This package is auto-updated.

Last update: 2024-05-05 17:33:51 UTC


README

Installation

  1. Run command to install a package into you project

    composer require limanweb/eloquent-logger

  2. Add package provider into providers section of your config/app.php

    'providers' => [ ... \Limanweb\EloquentLogger\ServiceProvider::class, ],

  3. Run command to publish package's config and migration

    php artisan vendor:publish

and choise package \Limanweb\EloquentLogger\ServiceProvider to publish.

Now you have configuration file config/limanweb/eloquent_logger.php.

  1. If you have changed user ID type to UUID in your project, then you must configure it in user section of configuration.

    'user' => [ ... 'key_cast' => 'string', 'key_create_method' => 'uuid', ],

  2. Run migrate command.

    php artisan migrate

  3. In App\Providers\EventServiceProvider add next line to bottom of boot()

    \Limanweb\EloquentLogger\LoggerService::initLogger();

Configuration

To turn on logger fore any model, add it into models section of configutarion.

'models' => [
	...
	App\AnyModel::class => [],
],	 

To exclude any model specified fields, add if into models.AnyModel.exclude_fields array of model declaration.

'models' => [
	...
	App\AnyModel::class => [
		'exclude_fields' => [
			'search',
		],
	],
],	 

To globally exclude any fields, add if into exclude_fields array of configutarion.

'exclude_fields' => [
	'created_at',
	'updated_at',
],