laravel模型关联查询 laravel从现有的数据库生成模型并通过模型操作数据库
一:拓展安装laravel中从现有的数据库生成模型并通过模型操作数据库需要使用到reliese/laravel拓展reliese/laravel插件地址: https://packagist.org/
顺晟科技
2022-09-15 20:47:33
324
按理说onAfterWrite
和 onAfterInsert
这个事件 的参数应该是入库后的数据【包含id】,就像ThinkPHP5
的 afterWrite
和 afterInsert
一样 都能得到 id。
// tp6
//写入后
public static function onAfterWrite($row)
{
print_r($row->toArray());
}
// tp5
protected static function init()
{
// 写入后
self::afterWrite(function ($row)
{
print_r($row->toArray());
}
}
tp6 如何实现 如 tp5 一样 更新后 等得到 id 索引呢??
26
2023-02
20
2022-10
22
2022-09
15
2022-09
15
2022-09
21
2021-10