defenestrator/laravel-immutable-eloquent

Laravel Eloquent 模型的不可变特性。

dev-main 2020-10-10 17:12 UTC

This package is auto-updated.

Last update: 2024-09-11 01:31:33 UTC


README

此包可能不是最优的,但可能对某些情况足够好

hashedContent() 方法默认返回 'state'

hashColumn() 方法默认返回 'hash'

使用 created_at 是可接受的但不是必需的

使用 updated_at 意味着可变性,因此不建议使用

Blueprint::timestamps()

可以通过简单地将静态变量

设置 static::$checkHash = false

在模型的 boot() 方法中禁用哈希检查。

这可能不是个好主意。

打字不是瓶颈,要努力思考。