PHP code example of codetech / laravel-api-logs
1. Go to this page and download the library: Download codetech/laravel-api-logs library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
codetech / laravel-api-logs example snippets
use CodeTech\ApiLogs\Http\Middleware\LogApiRequest;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Middleware;
return Application::configure(basePath: dirname(__DIR__))
// ...
->withMiddleware(function (Middleware $middleware) {
$middleware->appendToGroup('api', LogApiRequest::class);
})
// ...
->create();
use CodeTech\ApiLogs\Traits\HasApiLogs;
class User extends Authenticatable
{
use HasApiLogs;
}
$user->apiLogs; // all ApiLog entries for the user
bash
php artisan vendor:publish --provider="CodeTech\ApiLogs\Providers\ApiLogServiceProvider" --tag=migrations
bash
php artisan migrate