behaviorOperationLog = $behaviorOperationLog; } public function log($request) { $perPage = isset($request['per_page']) ? $request['per_page'] : 20; $where = []; if(isset($request['type'])){ $where[] = ['type', $request['type']]; } return $this->behaviorOperationLog ->where($where) ->where(function($query) use ($request){ if(isset($request['created_at'])){ $time = explode('_', $request['created_at']); $query->whereBetween('created_at', $time); } }) ->orderBy('id','desc') ->paginate($perPage); } }