You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
923 B

1 year ago
<?php
namespace App\Models;
class OperateLog extends SoftDeletesModel
{
protected $hidden = ['req_parameter'];
public function admin(){
return $this->hasOne(Admin::class,'id','admin_id');
}
public function department(){
return $this->hasOne(Department::class,'id','department_id');
}
/**
* 添加记录
* @param $admin
* @param $name
* @param $remark
* @return mixed
*/
public static function addLogs($admin,$name,$remark = ''){
return self::create([
'admin_id'=>$admin->id,
'department_id'=>$admin->department_id,
'name'=>$name,
'ip'=>request()->ip(),
1 year ago
'url'=>request()->url(),
'req_parameter'=>json_encode(request()->except(['password', 'old_password', 'new_password', 'token', 'code']),JSON_UNESCAPED_UNICODE),
1 year ago
'remark'=>$remark
]);
}
}