| Package Data | |
|---|---|
| Maintainer Username: | nickshek1 |
| Maintainer Contact: | alfshek@hotmail.com (Nick Shek) |
| Package Create Date: | 2016-06-25 |
| Package Last Update: | 2016-07-16 |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-10-27 15:02:38 |
| Package Statistics | |
|---|---|
| Total Downloads: | 140 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 0 |
| Total Watchers: | 1 |
| Total Forks: | 0 |
| Total Open Issues: | 0 |
A simple package to log all the requests in a database for Laravel 5.
Inspired by django-request
Note: This package is still very alpha!
You can install the package via composer:
composer require nickshek/laravel-request
Install service provider
// config/app.php
'providers' => [
...
LaravelRequest\LaravelRequestServiceProvider::class,
];
publish migrations and config file
php artisan vendor:publish --provider="LaravelRequest\LaravelRequestServiceProvider"
Afterwards you can edit the file config/laravel-request.php to suit your needs.
Run migration to create required tables
php artisan migrate
By default, the middleware \LaravelRequest\Middleware\LogAfterRequest::class enables logging on all pages. You'll probably want to inherit your own class containing you application's logging rule handler.
namespace App\Http\Middleware;
// app/Http/Middleware/LogAfterRequestExceptAdmin.php
use LaravelRequest\Middleware\LogAfterRequest;
class LogAfterRequestExceptAdmin extends LogAfterRequest
{
/**
* @return bool
*/
protected function shouldLogRequest($request, $response)
{
return $request->segment(1) !== 'admin';
}
}
Next, simply register the newly created class in your middleware stack.
// app/Http/Kernel.php
class Kernel extends HttpKernel
{
protected $middleware = [
// ...
\App\Http\Middleware\LogAfterRequestExceptAdmin::class,
];
// ...
}
That's it!
The MIT License (MIT). Please see License File for more information.