moonshine / changelog
MoonShine 模型 ChangeLog
1.0.3
2024-05-02 13:11 UTC
Requires
- php: ^8.1|^8.2
- ext-curl: *
- ext-json: *
Requires (Dev)
- brianium/paratest: ^6.8
- mockery/mockery: ^1.4.4
- orchestra/testbench: ^4.0|^5.0|^6.0|^7.0|^8.0
- phpstan/phpstan: ^1.4.7
- phpunit/phpunit: ^9.5.8
Conflicts
- moonshine/moonshine: <2.0
This package is auto-updated.
Last update: 2024-09-02 13:49:17 UTC
README
需求
- MoonShine v2.0+
安装
composer require moonshine/changelog
php artisan migrate
开始使用
将特性 HasChangeLog 添加到模型
class Post extends Model { use HasChangeLog; }
将组件添加到页面
protected function bottomLayer(): array { return [ ...parent::bottomLayer(), ChangeLog::make('Changelog', $this->getResource()) ]; }
或在资源中
class PostResource extends ModelResource { // ... protected function onBoot(): void { $this->getPages() ->formPage() ->pushToLayer( Layer::BOTTOM, ChangeLog::make('Changelog', $this) ); } // ... }
默认情况下,显示最后5个更改。要更改此设置,请使用 limit() 方法
ChangeLog::make('Changelog', $this)->limit(10)