Download the PHP package plakhin/laravel-request-chronicle without Composer
On this page you can find all versions of the php package plakhin/laravel-request-chronicle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download plakhin/laravel-request-chronicle
More information about plakhin/laravel-request-chronicle
Files in plakhin/laravel-request-chronicle
Package laravel-request-chronicle
Short Description Save incoming HTTP requests into the DB
License MIT
Homepage https://github.com/plakhin/laravel-request-chronicle
Informations about the package laravel-request-chronicle
Save incoming HTTP requests into the DB
Installation
You can install the package via composer:
Then you may optionally publish the config file with:
This is the contents of the published config file:
Then you need to publish and run the migrations with:
Usage
If you want to save every HTTP request to the database, you may append it to the global middleware stack in your application's bootstrap/app.php
file:
You can also apply the middleware to a specific route(s) only. Additionally you can specify the model you wish attach (using MorphTo
relationship) requests to, Route Model Binding should be used in this case:
All the requests will be stored in the database table specified in the config.
You can retrieve the requests using the Request
model:
You can also add the MorphMany
relationship to your model:
Pruning the database table
The Request
model uses the Laravel's MassPrunable
trait. In the config file, you can specify the number of hours to keep records using prune_after_hours
key and then to schedule the model:prune
command, as instructed in Laravel's docs. You'll have to explicitly add the model class:
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
- Stanislav Plakhin
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-request-chronicle with dependencies
illuminate/contracts Version ^11.35||^12.0
spatie/laravel-package-tools Version ^1.19