neon/attributable

3.0.0-alpha-7 2024-08-21 18:07 UTC

README

处理与各种模型相关的先进属性。采用此方案的原因是 Neon CMS 的最佳实践:如果客户需要像“在公司的页面上显示此电子邮件”这样的选项,我们可以在管理员界面上添加该电子邮件,就像添加属性一样,然后在模板中处理该变量,然后,无需程序员即可在指定页面上显示任何内容。

要求

  • "neon/model-uuid": "^1.0"

安装

轻松安装 composer 包

composer require neon/attributable

然后您应该通过以下方式安装数据库迁移

php artisan vendor:publish --provider=\"Neon\\Attributable\\NeonAttributableServiceProvider\"

用法

只需像使用其他 trait 一样使用此 trait。别忘了也要使用 neon/model-uuid trait

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Neon\Attributable\Models\Traits\Attributable;
use Neon\Models\Traits\Uuid;

class AwesomeModel extends Model
{
    use Attributable;
    use Uuid;

    ...

}

许可证

MIT 许可证 (MIT)。有关更多信息,请参阅许可证文件