<p align="center"><img width="200" src="https://thesugagroup.com//storage/logo_hor.svg"></p>


# Activity Log Module

Activity Log Module

## Requirement

- Composer 2.x
- Laravel 6.x
- PHP >= 7.2.5


## Installation

- Step 1: Copy package folder or clone this package to your Laravel app packages/w3suga folder.  
  Example: my-project/packages/w3suga/mod-activity-logs.
  
  
- Step 2: Add the following "repositories" key below the "scripts" section in `composer.json` file of your Laravel app:
    ```json
    {
    "repositories": [
        {
            "type": "path",
            "url": "packages/w3suga/mod-activity-log"
        }
      ]
    }
    ```
  
- Step 3: You can now require your local package in the Laravel app by run the command below:
    ```
    composer require w3suga/mod-activity-log
    ```
  
- Step 4: Publish activity_log config with command:  
    ```
    php artisan vendor:publish --provider=W3suga\ModActivityLog\ModActivityLogProvider
    ```
    After run this command, the `activity_log.php` file will be added to your Laravel project config folder.
  
- Step 5: Run migrate to create package tables
    ```
     php artisan migrate
    ```

## Usage

- Add new log:
  To Add new log for an account using: `\W3Log::log(...)` function:
    * @param Account $account
    * @param string $type
    * @param string|null $action
    * @param string|null $extraData
    * @return new ActivityLog

  Example: 
    ```
    \W3Log::log($user->id, 'logged_in', 'Account Vyle just logged in', json_encode($user));
    ```
  
## Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

