Logsifier::store('192.168.1.1','users','1','New user created','Users module')
Don't forget this line at the begining of your file:
I've been involved in several projects where is required to have some sort of log manipulation. I decided to create my own package first of all to introduce myself in package development and also to use it on my future projects.
Install via composer:
Add the line "metalcoder/logsifier": "master-dev" to your app main composer in the require section.
Make composer update
Make php artisan migrate --path=vendor/metalcoder/logsifier/src/migrations to run the package migration in charge of the creation of log table.
Go to config/app.php in your app and add Metalcoder\Logsifier\MetalcoderLogsifierServiceProvider::class, to the providers section.
In config/app.php add 'Logsifier' => Metalcoder\Logsifier\Logsifier::class, to the aliases section.
In config/app.php add Maatwebsite\Excel\ExcelServiceProvider::class, to the providers section.
In config/app.php add 'Excel' => Maatwebsite\Excel\Facades\Excel::class, to the aliases section.
Make php artisan vendor:publish
Now you are ready to go.
The package exposes 4 methods (at the time) to help with the log of relevant events in any laravel application.
/* Method to store a log entry in the database
Parameters: $ip : IP of the request
$object : Name of the database table the event is using
$object_id : id of the element the event is using
$description : Short descripcion of the event.
$source : Name of the application module that triggered the event
$urgent : If entry is marked as urgent an email will be sent to the recipients listed in config/logsifier.php