Logs for Laravel 5

dev-master 2022-03-21 19:41 UTC

This package is auto-updated.

Last update: 2024-10-22 01:41:34 UTC


README

Install

Via Composer

$ composer require webmachine/logs

Next, you must install the service provider and facade alias:

// config/app.php
'providers' => [
    ...
    Webmachine\Logs\LogsServiceProvider::class,
];

...

'aliases' => [
    ...
    'Logs' => Webmachine\Logs\LogsFacade::class,
];

Publish

$ php artisan vendor:publish --provider="Webmachine\Logs\LogsServiceProvider"

Usage

Add doer trait to user model

...
use Webmachine\Logs\Traits\LogDoer;

class User extends Model {
    use LogDoer;
    ...
}

Add traits to target models

...
use Webmachine\Logs\Traits\LogTarget;

class Foo extends Model {
    use LogTarget;
    ...
}

You can add a custom log description:

...
use Webmachine\Logs\LogsFacade as Logs;
...
public function storage() {
    ...
    Logs::setDescription('custom description');
    \App\Foo::create([...]);
}

License

The MIT License (MIT). Please see License File for more information.