Package
eloquent-log-driver
A Laravel Log Driver for Eloquent
1.2.03,239 downloads7 stars
A Laravel Log Driver for Eloquent
Installation
Via Composer
$ composer require juststeveking/eloquent-log-driverAfter installation, publish the migrations using:
Then we can run our migration, which will create a table called database_logs.
$ php artisan migrateRegistering the driver with Laravel
In your .env file add the following:
LOG_CHANNEL=eloquentThen add the following to your config/logging.php file under channels:
'eloquent' => [ 'driver' => 'custom', 'via' => \JustSteveKing\EloquentLogDriver\Logger\EloquentLogger::class]That is it! Your logs will now automatically start appearing in the database.
Querying Logs
There is a small selection of helper scope available on the DatabaseLog model:
whereDebug()whereInfo()whereNotice()whereWarning()whereError()whereCritical()whereAlert()whereEmergency()whereLevel('log-level-case-insensitive')
All of the above will return an instance of an Eloquent Builder, allowing you to chain on further query parameters.
Testing
$ composer run testContributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email juststevemcd@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
Related
More Packages
mavis
Run a freelance business from plain files: clients, calls and follow-ups, time, quotes and invoices as Markdown, from one Go binary, with an MCP server for agents.
v0.1.3
PHPcloudevents
Cloud Events in PHP.
dev-main
PHPcompanies-house-laravel
A Laravel wrapper to get companies house information and validate company numbers
v1.2.0
Same subject
In other formats
Let's Build in Public with JustSteveKing: Creating a Unified Event Tracker
🚀 Welcome to "Let's Build in Public" with JustSteveKing! In this exciting livestream series, we're diving into the world of startup development, taking on the challenge of building a dynamic applicat
PHP & Laravel
ArticleEffective Eloquent
Explore advanced Eloquent querying in Laravel with a focus on efficient ORM usage for a banking app, including user accounts and transactions management.
PHP & Laravel