We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
laravel 8.x 创建 Test Model 定义 attrs 字段定义成 AsArrayObject
namespace App\Models; class Test extends Model { protected $fillable = [ 'name', 'attrs' ]; protected $casts = [ 'attrs' => AsArrayObject::class ]; }
使用Test模型写入数据 并查看操作日志记录
\App\Models\Test::create([ 'name' => 'testName', 'attrs' => [ 'id' => 1, 'val' => 'testVal' ] ]); $logStr = \Chance\Log\facades\OperationLog::getLog(); var_dump($logStr);
执行结果
找到问题所在 因为字段被定义成了object 在获取字段数据的时候 object 类型 attrs 被强转成(string)会抛错
需要兼容下 object 数据类型 也转化一下
The text was updated successfully, but these errors were encountered:
我创建了 laravel 8.x 的新项目,没有复现这个问题。你的具体版本号是多少?
Sorry, something went wrong.
佬 版本是 laravel 8.83.27 但是跟小版本没有关系 主要是设置了表模型对应关系后,获取日志就会抛这个错
dbf2660
fix: Fixed bug with field type AsArrayObject
AsArrayObject
6cc190c
Closes #5
No branches or pull requests
laravel 8.x 创建 Test Model 定义 attrs 字段定义成 AsArrayObject
使用Test模型写入数据 并查看操作日志记录
执行结果
找到问题所在 因为字段被定义成了object 在获取字段数据的时候 object 类型 attrs 被强转成(string)会抛错
需要兼容下 object 数据类型 也转化一下
The text was updated successfully, but these errors were encountered: