承接 topix-hackademy/loggable-models 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

topix-hackademy/loggable-models

Composer 安装命令:

composer require topix-hackademy/loggable-models

包简介

A package to add log on models so that can be retrieved anytime

README 文档

README

This package provide a easy way to add a log for a Eloquent entity.

Installation

composer require topix-hackademy/loggable-models

in config/app.php

'providers' => [
    ..
    Topix\Hackademy\LoggableModels\Laravel\ServiceProvider::class,
    ..
     ]

then launch

php artisan vendor:publish

everything is ready.

Usage

Set the model you want to log like this

class Post extends Eloquent implements ModelLogInterface
{
    use ModelLogTrait;


}

Now on an instance of that model you can use any log method in the logger interface

$post->alert($message);

public function emergency($message, array $context = array());
public function alert($message, array $context = array());
public function critical($message, array $context = array());
public function error($message, array $context = array());
public function warning($message, array $context = array());
public function notice($message, array $context = array());
public function info($message, array $context = array());
public function debug($message, array $context = array());

to retrieve the logs you can use the plural form of those methods as get:

$post->alerts()

as well as there are the scopes for easy quering the database for every level.

scopeHasEmergencies()
...
 
Post::hasEmergencies()->get()

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-07-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固