skycoder / user-log
一个存储用户创建、更新、批准和公司日志的出色包
dev-master / 2.x-dev
2021-12-09 00:00 UTC
Requires
- php: ^7.2.5
This package is auto-updated.
Last update: 2024-09-10 23:24:24 UTC
README
用户日志 是一个小型包,可以帮助您存储创建、更新和批准用户的日志,还可以存储认证用户的公司信息。
这是一个小巧的包,可以轻松简化您的代码。
安装过程
composer require skycoder/user-log
发布视图
php artisan vendor:publish
按下持有 user-log
的数字
使用
您应该在包含 use Skycoder\UserLog\UserLog;
命名空间的模型中使用 use UserLog;
特性
并且使用 @include('user-log::user-logs', ['data' => $item])
在显示数据的表中,这里的 $item 是您的模型数据。
模型示例
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Skycoder\UserLog\UserLog; class ModelName extends Model { use UserLog; }
Blade 文件示例
<table class="table"> <thead> <tr> <th>Name</th> <th>Mobile</th> <th>Email</th> <th>Action</th> </tr> </thead> <tbody> @foreach ($items as $item) <tr> <td>{{ $item->name }}</td> <td>{{ $item->mobile }}</td> <td>{{ $item->email }}</td> <td> @include('user-log::user-logs', ['data' => $item]) </td> </tr> @endforeach </tbody> </table>