[ 'status' => 1, ], 'append'=>[ 'userID', 'groupID' ] ]); } function getGroupIDAttr($v,$row){ return $v?:$row['group_id']; } function getUserIDAttr($v,$row){ return $v?:$row['user_id']; } public static function onAfterInsert($row){ $changeData = $row->getChangedData(); if(isset($changeData['url'])) { Files::where('path',$changeData['url'])->inc('use_count'); }; } public static function onAfterUpdate($row){ $OrgData = $row->getOrigin(); $changeData = $row->getChangedData(); if(isset($OrgData['url']) && $OrgData['url']) { \support\Log::info('OrgData string'); Files::where('path',$OrgData['url'])->dec('use_count'); }; if(isset($changeData['url']) && $changeData['url']) { \support\Log::info('changeData string'); Files::where('path',$changeData['url'])->inc('use_count'); }; } public static function onAfterDelete($row){ Files::where('path',$row->url)->dec('use_count'); } }