lancodev/laravel-logging 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lancodev/laravel-logging

最新稳定版本:0.7

Composer 安装命令:

composer require lancodev/laravel-logging

包简介

This is my package laravel-logging

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package provides a simple way to log events to a database table. It provides a convenient Loggable Trait to allow you to link your logs to a model. It also provides a Log model that you can use to query your logs.

Installation

You can install the package via composer:

composer require lancodev/laravel-logging

You can publish and run the migrations with:

php artisan vendor:publish --tag="laravel-logging-migrations"
php artisan migrate

Usage

Add the Loggable Trait to your model(s) that you want to log events for.

Then, you can create logs for the model using the logs relationship:

$model->logs()->create([
    'type' => 'Info',
    'log' => 'lorem ipsum',
]);

To view logs for a given model, you can use the logs relationship:

$model->logs;

Or use standard Eloquent query language to filter the logs by type, etc:

$model->logs()->where('type', 'Info')->get();

Lancodev\LaravelLogging\Models\Log {
  id: 1,
  loggable_type: "App\Models\{SOME_MODEL}",
  loggable_id: 1,
  type: "Info",
  log: "lorem ipsum",
  created_at: "2023-01-01 00:00:00",
  updated_at: "2023-01-01 00:00:00",
},

The Log model also has a loggable relationship that allows you to access the model that the log belongs to:

$log->loggable;****

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 1.17k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-02-22