neuecommerce/visible-records

处理Laravel Eloquent模型记录的可见状态。

dev-main / 1.0.x-dev 2024-03-22 20:40 UTC

This package is auto-updated.

Last update: 2024-09-22 21:37:17 UTC


README

GitHub Tests Action Status GitHub Code Analysis Action Status Software License Latest Version on Packagist Total Downloads

Laravel Eloquent模型的活动日志。

安装

  1. 使用Composer安装包
composer require neuecommerce/visible-records

实现

自动

在Eloquent模型上实现Visible Records包非常简单,只需3个简单步骤

  1. 在你的模型(s)上实现NeueCommerce\VisibleRecords\HasVisibilityInterface接口。

  2. 在你的模型(s)上实现NeueCommerce\VisibleRecords\HasVisibility特质。

  3. 创建一个数据库迁移,向你的模型(s)表添加可空的visibile_at时间戳列。

以下是一个具有正确实现的模型示例

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use NeueCommerce\VisibleRecords\HasVisibilityInterface;
use NeueCommerce\VisibleRecords\HasVisibility;

class Product extends Model implements HasVisibilityInterface
{
    use HasVisibility;

    public $table = 'products';
}

以下是一个数据库迁移示例

<?php

...

用法

...

测试

composer test

贡献

感谢您的兴趣。以下是一些许多贡献方式之一。

许可证

MIT许可证(MIT)。请参阅许可证文件获取更多信息。